diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index 0f812e6a4386b17b46d662bed563beae66d3b7da..e77badd5531abb7be536650c30b4bdf3717fe15e 100644 (file)
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
$smarty = get_smarty(); // Smarty instance
$userfilter = get_global("userfilter"); // contains Filter Settings
$s_action = ""; // Contains the action to proceed
/* Generate template list */
if (($s_action=="new")||($s_action=="create_user_from_tpl")){
+
$this->templates= array();
+
$ldap= $this->config->get_ldap_link();
+
+ /* Create list of tempaltes */
foreach ($this->config->departments as $key => $value){
+
+ /* Get acls from different ou's */
$acl= get_permissions (get_people_ou().$value, $this->ui->subtreeACL);
$acl= get_module_permission($acl, "user", get_people_ou().$value);
+
+ /* If creation of a new user is allowed, append this template */
if (chkacl($acl, "create") == ""){
+
+ /* Search all templates from the current dn */
$ldap->cd (get_people_ou().$value);
$ldap->search ("(objectClass=gosaUserTemplate)", array("uid"));
+ /* Append */
if ($ldap->count() != 0){
while ($attrs= $ldap->fetch()){
$this->templates[$ldap->getDN()]=
}
}
}
+
+ /* Sort templates */
natcasesort ($this->templates);
reset ($this->templates);
}
$this->usertab= new usertabs($this->config,
$this->config->data['TABS']['USERTABS'], $this->dn);
$this->usertab->set_acl(array(':all'));
+ $this->usertab->by_object['user']->base= $userfilter['depselect'];
/* Take care about templates */
if ($s_action=="new_tpl"){
}
/* Use template if there are any of them */
- if ((count($this->templates) && !isset($_POST['new_template']))||($s_action=="create_user_from_tpl")){
+
+ if ((count($this->templates) && ($s_action!='new_tpl'))||($s_action=="create_user_from_tpl")){
foreach(array("sn", "givenName", "uid", "got_uid", "templates") as $attr){
$smarty->assign("$attr", $this->$attr);
}
if ($s_action=="create_user_from_tpl"){
$smarty->assign("template", $this->dn= $this->list[trim($s_entry)]['dn']);
} else {
- $smarty->assign("template", "");
+ $smarty->assign("template", "none");
}
$smarty->assign("edit_uid", "");
return($smarty->fetch(get_template_path('template.tpl', TRUE)));
$this->usertab->givenName = $this->givenName;
$template_dn = $_POST['template'];
$this->usertab->adapt_from_template($template_dn);
- $template_base = $userfilter['depselect'];//preg_replace("/^[^,]+,".get_people_ou()."/", '', $template_dn);
+ $template_base = preg_replace("/^[^,]+,".get_people_ou()."/", '', $template_dn);
$this->usertab->by_object['user']->base= $template_base;
/* Set up the users ACL's for this 'dn' */
$acl= get_permissions ($template_base, $this->ui->subtreeACL);
$this->usertab->set_acl($acl);
}
+
+ if (isset($_POST['template_continue']) && ($_POST['template'] == 'none')){
+ $this->usertab->by_object['user']->base= $userfilter['depselect'];
+ }
/* Show tab dialog if object is present */
if ($this->usertab){
/* NEW LIST MANAGMENT */
$listhead = "<div style='background:#F0F0F9;padding:5px;'>".
- " <input type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
- " <input type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
- " <input type='image' align='middle' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
- " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- " <input type='image' align='middle' src='images/list_new_user.png' title='"._("Create new user")."' alt='"._("New user")."' name='user_new'> ".
- " <input type='image' align='middle' src='images/list_new.png' title='"._("Create new template")."' alt='"._("New template")."' name='user_tplnew'> ".
- " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
- _("Current base")." <select name='depselect' onChange='mainform.submit()'>$options</select>".
- " <input type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ".
+ " <input class='center' type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
+ " <input class='center' type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
+ " <input class='center' type='image' align='middle' src='images/list_home.png' title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
+ " <input class='center' type='image' align='middle' src='images/list_new_user.png' title='"._("Create new user")."' alt='"._("New user")."' name='user_new'> ".
+ " <input class='center' type='image' align='middle' src='images/list_new.png' title='"._("Create new template")."' alt='"._("New template")."' name='user_tplnew'> ".
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
+ _("Current base")." <select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
+ " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ".
"</div>";
- $action= "<input type='image' src='images/edit.png' alt='"._("edit")."' name='user_edit_%KEY%' title='"._("Edit user")."'>";
- $action.= "<input type='image' src='images/list_password.png' alt='"._("password")."' name='user_chgpw_%KEY%' title='"._("Change password")."'>";
- $action.= "<input type='image' src='images/edittrash.png' alt='"._("delete")."' name='user_del_%KEY%' title='"._("Delete user")."'>";
+ $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='user_edit_%KEY%' title='"._("Edit user")."'>";
+ $action.= "<input class='center' type='image' src='images/list_password.png' alt='"._("password")."' name='user_chgpw_%KEY%' title='"._("Change password")."'>";
+ $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='user_del_%KEY%' title='"._("Delete user")."'>";
$divlist = new divlist("userstab");
$divlist->SetHeader(array(
- array("string" => " "),
- array("string" => _("Username")." / "._("Department")),
- array("string" => _("Properties")),
- array("string" => _("Actions"), "attach" => "style='border:none'" )));
+ array("string" => " ", "attach" => "style='text-align:center;width:20px;'"),
+ array("string" => _("Username")." / "._("Department"), "attach" => "style=''"),
+ array("string" => _("Properties"), "attach" => "style='width:152px;'"),
+ array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'")));
$divlist->SetSummary(_("This table displays all users, in the selected tree."));
- $divlist->SetEntriesPerPage(20);
+ $divlist->SetEntriesPerPage(0);
// Defining Links
$linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
}
}
- $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>");
- $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
- $field3 = array("string" => " ");
- $field4 = array("string" => " ", "attach" => "style='border:none'");
+ $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
+ $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''");
+ $field3 = array("string" => " ", "attach" => "style='width:152px;'");
+ $field4 = array("string" => " ", "attach" => "style='width:60px;border-right:0px;text-align:right;'");
$divlist->AddEntry(array($field1,$field2,$field3,$field4));
}
/* Pictures for Extensions */
- $usrimg ="<input type='image' src='images/penguin.png' alt='"._("GOsa")."'
+ $usrimg ="<input class='center' type='image' src='images/penguin.png' alt='"._("GOsa")."'
name='user_edit_%KEY%-user' title='"._("Edit generic properties")."'>";
- $posiximg = "<input type='image' src='images/select_user.png' alt='"._("Posix")."'
+ $posiximg = "<input class='center' type='image' src='images/select_user.png' alt='"._("Posix")."'
name='user_edit_%KEY%-posixAccount' title='"._("Edit UNIX properties")."'>";
- $eviroimg = "<input type='image' src='images/network.png' alt='"._("Environment")."'
+ $eviroimg = "<input class='center' type='image' src='images/smallenv.png' alt='"._("Environment")."'
name='user_edit_%KEY%-environment' title='"._("Edit environment properties")."'>";
- $mailimg = "<input type='image' src='images/mailto.png' alt='"._("Mail")."'
+ $mailimg = "<input class='center' type='image' src='images/mailto.png' alt='"._("Mail")."'
name='user_edit_%KEY%-mailAccount' title='"._("Edit mail properties")."'>";
- $fonimg = "<input type='image' src='images/%image%' alt='"._("Phone")."'
+ $fonimg = "<input class='center' type='image' src='images/%image%' alt='"._("Phone")."'
name='user_edit_%KEY%-phoneAccount' title='"._("Edit phone properties")."%title%'>";
- $faximg = "<input type='image' src='images/fax_small.png' alt='"._("Fax")."'
+ $faximg = "<input class='center' type='image' src='images/fax_small.png' alt='"._("Fax")."'
name='user_edit_%KEY%-gofaxAccount' title='"._("Edit fax properies")."'>";
- $sambaimg = "<input type='image' src='images/select_winstation.png' alt='"._("Samba")."'
+ $sambaimg = "<input class='center' type='image' src='images/select_winstation.png' alt='"._("Samba")."'
name='user_edit_%KEY%-sambaAccount' title='"._("Edit samba properties")."'>";
- $tplcreateuserimg = "<input type='image' src='images/list_new.png' alt='"._("Create user from template")."'
+ $tplcreateuserimg = "<input type='image' class='center' src='images/list_new.png' alt='"._("Create user from template")."'
name='userfrom_tpl_%KEY%' title='"._("Create user with this template")."'>";
- $empty = "<img src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+ $empty = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
// User and Template Images
- $userimg = "<img src='images/select_user.png' alt='User' title='%s'>";
- $tplimg = "<img src='images/select_template.png' alt='Template' title='%s'>";
+ $userimg = "<img class='center' src='images/select_user.png' alt='User' title='%s'>";
+ $tplimg = "<img class='center' src='images/select_template.png' alt='Template' title='%s'>";
$editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
// Defines Arrays to save User and Templates
/*
If you want to disable the status pictures, just comment out the next line
*/
- $r_con= @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
- // Check if we are connected correctly
- if($r_con){
- $r_db = @mysql_select_db($a_SETUP['DB'],$r_con);
+ $r_con = false;
+ $r_db = false;
+ if(is_callable("mysql_pconnect")){
+ $r_con= @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']);
+ // Check if we are connected correctly
+ if($r_con){
+ $r_db = @mysql_select_db($a_SETUP['DB'],$r_con);
+ }
}
}
$fonac = preg_replace("/%title%/", "", $fonac);
/* Database connection is ok ?*/
- if($r_db){
+ if(($r_db)&&(is_callable("mysql_query"))){
$res= @mysql_query("SELECT regseconds,name,port,ipaddr FROM ".$a_SETUP['SIP_TABLE']." WHERE (name='".$val['uid'][0]."')");
$mysql_entry = @mysql_fetch_row($res);
if(is_array($mysql_entry)){
$fonac=$empty;
}
+
+
// Specify Pics for Extensions
if(in_array("posixAccount" ,$val['objectClass'])){
$posix = preg_replace("/%KEY%/", "$key", $posiximg);
$tpl=$userimg;
}
- $usrimg = preg_replace("/%KEY%/", "$key", $usrimg);
+ $usrimg2 = preg_replace("/%KEY%/", "$key", $usrimg);
// Generate caption for rows
if (isset($val["sn"]) && isset($val["givenName"])){
}
/* Create each field */
- $field1 = array("string" => sprintf($tpl,$val['dn']),"attach"=>"style='width:20px;align:middle;'");
- $field2 = array("string" => sprintf($editlink,$key,$display).$ip_port,"attach"=>"title='".$val['dn']."'");
- $field3 = array("string" => $usrimg." ".$posix." ".$enviro." ".$maila." ".$fonac." ".$faxac." ".$samba." ".$s_img_create_from_template, "attach" => "style='width:138px;'");
- $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='border:none; text-align:right;width:48px'");
+ $field1 = array("string" => sprintf($tpl,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
+ $field2 = array("string" => sprintf($editlink,$key,$display).$ip_port, "attach" => "style='' title='".$val['dn']."'");
+ $field3 = array("string" => $usrimg2." ".$posix." ".$enviro." ".$maila." ".$fonac." ".$faxac." ".$samba." ".$s_img_create_from_template, "attach" => "style='width:152px;'");
+ $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='width:60px;border-right:0px;text-align:right;'");
$add = array($field1,$field2,$field3,$field4);
$smarty->assign("alphabet", generate_alphabet());
$smarty->assign("hint", print_sizelimit_warning());
+ if((is_callable("mysql_close"))&&($r_con)){
+ @mysql_close($r_con);
+ }
return ($smarty->fetch(get_template_path('headpage.tpl', TRUE)));
}
* We also need to search for the departments
* So we are able to navigate like in konquerer
*/
- $base2 = preg_replace("/ou=people,/i","",$base);
+ /* Create base to search in */
+
+ $peopleOU = get_people_ou();
+ if(empty($peopleOU)) {
+ $base2 = $base;
+ }else{
+ $base2 = preg_replace("/".$peopleOU."/i","",$base);
+ }
+
+ /* Get all departments within this subtree */
$res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
TRUE, $base2, array("ou", "description"), TRUE);
$this->departments= array();
+ /* Create array with results */
$tmp = array();
foreach ($res3 as $value){
$tmp[strtolower($value['dn']).$value['dn']]=$value;
}
+
+ /* Sort array */
ksort($tmp);
+
+ /* Create result array */
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']);
}
}
/* END NEW LIST MANAGMENT