From: hickert Date: Tue, 16 Aug 2005 06:30:11 +0000 (+0000) Subject: goFonConference X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=978b2d789c11c34d6842d76c4e4082c7dae5ff5e;p=gosa.git goFonConference git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1147 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/gofon/conference/.class_phoneConferenceManagment.inc.swp b/plugins/gofon/conference/.class_phoneConferenceManagment.inc.swp new file mode 100644 index 000000000..601a09c31 Binary files /dev/null and b/plugins/gofon/conference/.class_phoneConferenceManagment.inc.swp differ diff --git a/plugins/gofon/conference/.generic.tpl.swp b/plugins/gofon/conference/.generic.tpl.swp new file mode 100644 index 000000000..22be8d343 Binary files /dev/null and b/plugins/gofon/conference/.generic.tpl.swp differ diff --git a/plugins/gofon/conference/.tabs_conference.inc.swp b/plugins/gofon/conference/.tabs_conference.inc.swp new file mode 100644 index 000000000..56bfa3ad0 Binary files /dev/null and b/plugins/gofon/conference/.tabs_conference.inc.swp differ diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc new file mode 100644 index 000000000..2d44350b4 --- /dev/null +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -0,0 +1,212 @@ +is_account= TRUE; + $this->ui= get_userinfo(); + $this->dn= $dn; + $this->orig_dn= $dn; + $this->config= $config; + + /* Set base */ + if ($this->dn == "new"){ + $ui= get_userinfo(); + if(isset($_SESSION['depfilter']['depselect'])){ + $this->base = $_SESSION['depfilter']['depselect']; + }else{ + $this->base= dn2base($ui->dn); + } + } else { + $this->base= preg_replace ("/^[^,]+,/", "", $this->dn); + } + } + + function execute() + { + /* Reload departments */ + $this->config->departments= get_departments($this->dn); + $this->config->make_idepartments(); + $smarty= get_smarty(); + + $smarty->assign("goFonConferenceOptions", array("P"=>"Conference ",""=>"Conference without PIN")); + $smarty->assign("goFonConferenceOptionFormats", array("P"=>"Conference ",""=>"Conference without PIN")); + $smarty->assign("goFonConferenceOption" ,$this->goFonConferenceOption_P); + + foreach ($this->attributes as $val){ + $smarty->assign("$val", $this->$val); + $smarty->assign("$val"."ACL", chkacl($this->acl, "$val")); + if($this->$val){ + $smarty->assign($val."CHK", ""); + }else{ + $smarty->assign($val."CHK", " checked "); + } + } + $smarty->assign("bases", $this->config->idepartments); + $smarty->assign("base_select", $this->base); + return($smarty->fetch (get_template_path('generic.tpl', TRUE))); + } + + function clear_fields() + { + $this->dn= ""; + $this->base= ""; + $this->acl= "#none#"; + + foreach ($this->attributes as $val){ + $this->$val= ""; + } + } + + + 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->handle_post_events('remove'); + } + + + /* Save data to object */ + function save_object() + { + if (isset($_POST['base'])){ + plugin::save_object(); + + /* Save base, since this is no LDAP attribute */ + if (chkacl($this->acl, "create") == ""){ + $this->base= $_POST['base']; + } + } + } + + + /* Check values */ + function check() + { + $message= array(); + + /* Permissions for that base? */ + $this->dn= "ou=$this->ou,".$this->base; + $acl= get_permissions ($this->dn, $this->ui->subtreeACL); + $acl= get_module_permission($acl, "department", $this->dn); + if (chkacl($acl, "create") != ""){ + $message[]= _("You have no permissions to create a department on this 'Base'."); + } + + /* Check for presence of this department */ + $ldap= $this->config->get_ldap_link(); + $attrs= $ldap->cat ($this->dn); + if ($this->orig_dn == "new" && !($attrs === FALSE)){ + $message[]= _("Department with that 'Name' already exists."); + } elseif ($this->orig_dn != $this->dn && !($attrs === FALSE)){ + $message[]= _("Department with that 'Name' already exists."); + } + + /* All required fields are set? */ + if ($this->ou == ""){ + $message[]= _("Required field 'Name' is not set."); + } + if ($this->description == ""){ + $message[]= _("Required field 'Description' is not set."); + } + + /* Validate and modify - or: spaghetti rules! */ + if ($this->ou == "incoming"){ + $message[]= _("The field 'Name' contains the reserved word 'incoming'.". + " Please choose another name."); + } + if (preg_match ('/[,#+:=>\\\\]/', $this->ou)){ + $message[]= _("The field 'Name' contains invalid characters."); + } + if (!is_phone_nr($this->telephoneNumber)){ + $message[]= _("The field 'Phone' contains an invalid phone number."); + } + if (!is_phone_nr($this->facsimileTelephoneNumber)){ + $message[]= _("The field 'Fax' contains an invalid phone number."); + } + + return $message; + } + + + /* Save to LDAP */ + function save() + { + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cat($this->dn); + $a= $ldap->fetch(); + $ldap->cd($this->dn); + if (count($a)){ + $ldap->modify($this->attrs); + $this->handle_post_events('modify'); + } else { + $ldap->add($this->attrs); + $this->handle_post_events('add'); + } + show_ldap_error($ldap->get_error()); + + /* Optionally execute a command after we're done */ + $this->postcreate(); + } + +} + +?> diff --git a/plugins/gofon/conference/class_phoneConferenceManagment.inc b/plugins/gofon/conference/class_phoneConferenceManagment.inc new file mode 100644 index 000000000..f2e0bb69e --- /dev/null +++ b/plugins/gofon/conference/class_phoneConferenceManagment.inc @@ -0,0 +1,163 @@ + "Eins ist toll", "zwei" => "Zwei ist noch besser"); + + /* Headpage attributes */ + var $conferences = array(); + + /* attribute list for save action */ + var $attributes = array(); + var $objectclasses = array(); + var $conftab = false; + + /* Initialise Class */ + function phoneConferenceManagment ($config, $ui) + { + $this->ui = $ui; + $this->dn = ""; + $this->config = $config; + } + + /* 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 -... + + foreach($_POST as $post => $key){ + if(preg_match("/.*new.*/i",$post)){ + $s_action = "new"; + } + } + + if($s_action == "new"){ + $this->dn= "new"; + $this->conftab= new conferencetabs($this->config,$this->config->data['TABS']['CONFERENCETABS'], $this->dn); + $this->conftab->set_acl(array(':all')); + } + + /* if edit or new, show dialog */ + 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.= "

\n"; + $display.= "\n"; + $display.= " \n"; + $display.= "\n"; + $display.= "

"; + } + return ($display); + } + + $this->reload(); + $listhead = "
+   +
"; + $actions = ""; + $actions.= ""; + $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'"))); + + foreach($this->conferences as $conference ){ + $field1 = array("string"=>""); + $field2 = array("string"=>$conference['cn'][0]); + $field3 = array("string"=>""); + $divlist->AddEntry(array($field1,$field2,$field3)); + } + + $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()); + + $display= $smarty->fetch(get_template_path('headpage.tpl', TRUE)); + return($display); + } + + + function reload() + { + $base = "dc=gonicus,dc=de"; + $this->conferences= get_list($this->ui->subtreeACL, "(objectClass=goFonAccount)",TRUE, $base, array("*"), TRUE); + + } + + 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); + } + } + +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/plugins/gofon/conference/generic.tpl b/plugins/gofon/conference/generic.tpl new file mode 100644 index 000000000..3c7e55a2d --- /dev/null +++ b/plugins/gofon/conference/generic.tpl @@ -0,0 +1,163 @@ + + + + + + + + + + + + +
+

+ {t}Properties{/t} +

+ + + + + + + + + + + + + + + + + +
+ + {$must} + + +
+ + {$must} + + +

{$must} + +
+ +
+

{t}Location{/t}

+ + + + + + + + + + +
+ {t}Lifetime in days{/t} + + +
+ {t}Number{/t} + + +
+ +
+

 

+
+

{t}Options{/t}

+ + + + + + + + + + + + + + + + + + + +
+ + {t}PIN vorgeben{/t} +
+   {t}PIN{/t} + + +
+

+
+ + {t}Record Conference{/t} +
+   {t}Format{/t} + + +
+ +
+ + + + + + + + + + + + + + + + + +
+ {t}Play music on hold{/t} + + +
+ {t}Activate menu{/t} + + +
+ {t}Announce new or leaving user{/t} + + +
+ {t}Count user{/t} + + +
+ +
+ + + diff --git a/plugins/gofon/conference/headpage.tpl b/plugins/gofon/conference/headpage.tpl new file mode 100644 index 000000000..065e3ab5c --- /dev/null +++ b/plugins/gofon/conference/headpage.tpl @@ -0,0 +1,31 @@ + + + + + +
+
+

+ {t}List of conference rooms{/t} {$hint} +

+
+
+ {$conferencehead} +
+
+
+ {$conferences} + +
+
+
+

[i]{t}Information{/t}

+
+
+

+ {t}This menu allows you to create, delete and edit selected departments. Having a large size of departments, you might prefer the range selectors on top of the department list.{/t} +

+
+
+ + diff --git a/plugins/gofon/conference/main.inc b/plugins/gofon/conference/main.inc new file mode 100644 index 000000000..98b665dff --- /dev/null +++ b/plugins/gofon/conference/main.inc @@ -0,0 +1,55 @@ +remove_lock(); + del_lock ($ui->dn); + sess_del ('conference'); + } +} else { + /* Create usermanagement object on demand */ + if (!isset($_SESSION['conference']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ + $_SESSION['conference']= new phoneConferenceManagment($config, $ui); + } + $conference= $_SESSION['conference']; + $output= $conference->execute(); + + /* Page header*/ + if (isset($_SESSION['objectinfo'])){ + $display= print_header(get_template_path('images/conference.png'), _("conference management"), "\"\" ".$_SESSION['objectinfo']); + } else { + $display= print_header(get_template_path('images/conference.png'), _("conference management")); + } + + /* Reset requested? */ + if (isset($_GET['reset']) && $_GET['reset'] == 1){ + del_lock ($ui->dn); + sess_del ('conference'); + } + + /* Show and save dialog */ + $conference->save_object(); + $display.= $output; + $_SESSION['conference']= $conference; +} + +?> diff --git a/plugins/gofon/conference/remove.tpl b/plugins/gofon/conference/remove.tpl new file mode 100644 index 000000000..543d1da34 --- /dev/null +++ b/plugins/gofon/conference/remove.tpl @@ -0,0 +1,19 @@ +
+  {t}Warning{/t} +
+ +

+ {$info} + {t}This includes all accounts, systems, etc. in this subtree. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t} +

+ +

+ {t}Best thing to do before performing this action would be to save the current contents of your LDAP tree in a file. So - if you've done so - press Delete to continue or Cancel to abort.{/t} +

+ +

+ +   + +

+ diff --git a/plugins/gofon/conference/tabs_conference.inc b/plugins/gofon/conference/tabs_conference.inc new file mode 100644 index 000000000..a3497db29 --- /dev/null +++ b/plugins/gofon/conference/tabs_conference.inc @@ -0,0 +1,34 @@ +base= $this->by_object['conference']->base; + } + + function check() + { + return (tabs::check(TRUE)); + } + + + function save() + { + $baseobject= $this->by_object['conference']; + $new_dn= 'ou='.$baseobject->ou.','.$baseobject->base; + + if ($this->dn != $new_dn && $this->dn != "new"){ + $baseobject->recursive_move($this->dn, $new_dn); + } + $this->dn= $new_dn; + + tabs::save(TRUE); + } + +} + +?>