summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e23e0f3)
raw | patch | inline | side by side (parent: e23e0f3)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 21 Mar 2006 07:56:44 +0000 (07:56 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 21 Mar 2006 07:56:44 +0000 (07:56 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2874 594d385d-05f5-0310-b6e9-bd551577e9d8
index f83b415ba22242efa150765fb19c7f5772c0a676..154c940bde99bf3a2c8759c11c4e7bd786a544b1 100644 (file)
var $dialogOpen = false;
var $objectdn = false;
+ var $lastdn = "";
+
var $was_successfull = false;
/* Create CP handler
/* Clears all copy & paste informations
*/
- function Clear($current_too = false)
+ function Clear()
{
$this->copyCurrent = false;
$this->cutCurrent = false;
$this->dialogOpen = false;
- if($current_too){
- $this->current = NULL;
- }
+ $this->current = NULL;
}
foreach($obj->attributes as $attr){
$this->current->by_object[$name]->$attr = $obj->$attr;
}
+ foreach(array("is_account") as $attr){
+ if(isset($obj->$attr)){
+ $this->current->by_object[$name]->$attr = $obj->$attr;
+ }
+ }
}
if($this->isCurrentObjectPastAble()){
return(true);
$this->dialogOpen =false;
$smarty = get_smarty();
$smarty->assign("Complete",true);
+ $this->lastdn= $this->current->dn;
$this->Clear();
return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE)));
$this->dialogOpen =false;
$smarty = get_smarty();
$smarty->assign("Complete",true);
+ $this->lastdn = $this->current->dn;
$this->Clear();
if($displayMessageOnSuccess){
return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE)));
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index d3b3b46e4fe77cc10fc516c258ccb1e2045c3b57..093e66446eacaff44da22c8e6778a7fbe50a8841 100644 (file)
var $got_uid= false;
var $departments=array();
+ var $CopyPasteHandler ;
+ var $enableCopyPaste = false;
+
function userManagement ($config, $ui)
{
/* Save configuration for internal use */
$this->config= $config;
$this->ui= $ui;
+ /* Copy & Paste handler */
+ if((isset($this->config->data['MAIN']['ENABLECOPYPASTE']))&&(preg_match("/true/i",$this->config->data['MAIN']['ENABLECOPYPASTE']))){
+ $this->enableCopyPaste = true;
+ }
+ $this->CopyPasteHandler = new CopyPasteHandler($this->config);
/* Get global filter config */
if (!isset($_SESSION["userfilter"])){
}elseif(preg_match("/userfrom_tpl.*/i",$key)){
$s_action="create_user_from_tpl";
$s_entry = preg_replace("/userfrom_tpl_/i","",$key);
+ }elseif(preg_match("/^editPaste.*/i",$key)){
+ $s_action="editPaste";
+ }elseif(preg_match("/^copy_.*/",$key)){
+ $s_action="copy";
+ $s_entry = preg_replace("/^copy_/i","",$key);
+ }elseif(preg_match("/^cut_.*/",$key)){
+ $s_action="cut";
+ $s_entry = preg_replace("/^cut_/i","",$key);
}
}
}
}
+
+ /* Only perform copy / paste if it is enabled
+ */
+ if($this->enableCopyPaste){
+
+ /* Paste copied/cutted object in here
+ */
+ if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
+ $this->CopyPasteHandler->save_object();
+ $this->CopyPasteHandler->SetVar("base",$userfilter['depselect']);
+ $ret = $this->CopyPasteHandler->execute(false);
+ if($ret) return($ret);
+ $this->reload();
+ $s_action = "change_pw";
+ $dn = $this->CopyPasteHandler->lastdn;
+
+ foreach($this->list as $id => $entry){
+ if($entry['dn'] == $dn){
+ $s_entry = $id;
+ }
+ }
+ $s_action = "change_pw";
+ }
+
+
+ /* Copy current object to CopyHandler
+ */
+ if($s_action == "copy"){
+ $this->CopyPasteHandler->Clear();
+
+ $dn = $this->list[trim($s_entry)]['dn'];
+ $acl = get_permissions ($dn, $this->ui->subtreeACL);
+
+ $obj = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn);
+ $objNew = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], "new");
+
+ $obj->set_acl($acl);
+ $objNew->set_acl($acl);
+
+ foreach($obj->by_object as $name => $tab){
+ foreach(array("photoData","jpegPhoto","is_account") as $attr){
+ if(isset($obj->by_object[$name]->$attr)){
+ $objNew->by_object[$name]->$attr = $obj->by_object[$name]->$attr;
+ }
+ }
+ }
+ $this->CopyPasteHandler->Copy($obj,$objNew);
+ }
+
+
+ /* Copy current object to CopyHandler
+ */
+ if($s_action == "cut"){
+ $this->CopyPasteHandler->Clear();
+ $dn = $this->list[trim($s_entry)]['dn'];
+ $acl= get_permissions ($dn, $this->ui->subtreeACL);
+
+ $obj = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn);
+ $obj->set_acl($acl);
+
+ $this->CopyPasteHandler->Cut($obj);
+ }
+ }
+
/* End for new List Managment */
/* Save filter data if we are in the headpage */
}
}
+
+ /* Create paste icon
+ */
+ if($this->enableCopyPaste){
+ $Copy_Paste = " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
+ if($this->CopyPasteHandler->isCurrentObjectPastAble()){
+ if($this->CopyPasteHandler->isCurrentCutted()){
+ $img = "images/cutpaste.png";
+ }else{
+ $img = "images/copypaste.png";
+ }
+ $Copy_Paste .= "<input type='image' name='editPaste' class='center'
+ src='".$img."' alt='"._("Paste")."' title='".$this->CopyPasteHandler->GetCurrentDn()."'> ";
+ }else{
+ $Copy_Paste .= "<img class='center' src='images/cant_editpaste.png' alt='"._("Can't paste")."'> ";
+ }
+ }else{
+ $Copy_Paste ="";
+ }
+
+
/* NEW LIST MANAGMENT */
$listhead = "<div style='background:#F0F0F9;padding:5px;'>".
" <input class='center' type='image' align='middle' src='images/list_back.png' title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
" <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'> ".
+ $Copy_Paste.
" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
_("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 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")."'>";
+
+
+
+ if($this->enableCopyPaste){
+ $action = "<input class='center' type='image'
+ src='images/editdelete.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
+ $action.= "<input class='center' type='image'
+ src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ $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")."'>";
+ }else{
+ $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")."'>";
+ }
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;'")));
+ array("string" => _("Actions"), "attach" => "style='width:90px;border-right:0px;text-align:right;'")));
$divlist->SetSummary(_("This table displays all users, in the selected tree."));
$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;'");
+ $field4 = array("string" => " ", "attach" => "style='width:90px;border-right:0px;text-align:right;'");
$divlist->AddEntry(array($field1,$field2,$field3,$field4));
$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;'");
+ $field4 = array("string" => preg_replace("/%KEY%/", "$key", $action),"attach" => "style='width:90px;border-right:0px;text-align:right;'");
$add = array($field1,$field2,$field3,$field4);
index 9569ed3969e3e613fabc64ea47d98c27aa8bab7f..5ac4fb7b3a1321b791928caf86904e9f3a2b59a9 100644 (file)
$this->by_object[$key]->is_template= TRUE;
}
}
+
+ function saveCopyDialog()
+ {
+ tabs::saveCopyDialog();
+ $baseobject= $this->by_object['user'];
+ $uid = $baseobject->uid;
+ foreach($this->by_object as $name => $obj){
+ $this->by_object[$name]->uid = $uid;
+ }
+ }
}
diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc
index a5498c798aa7c89f166d7c42d929f288d33d2a01..c68ed4e2f97706989bc935b03a39ba542af3c436 100644 (file)
/* Save data to LDAP */
$ldap->cd($this->dn);
$this->cleanup();
-$ldap->modify ($this->attrs);
+ unset($this->attrs['uid']);
+ $ldap->modify ($this->attrs);
show_ldap_error($ldap->get_error());
}
reset ($this->grouplist);
}
+
+ function getCopyDialog()
+ {
+ if(!$this->is_account) return("");
+ if ($this->force_ids == 1){
+ $force_ids = "checked";
+ if ($_SESSION['js']){
+ $forceMode = "";
+ }
+ } else {
+ if ($_SESSION['js']){
+ if($this->acl != "#none#")
+ $forceMode ="disabled";
+ }
+ $force_ids = "";
+ }
+
+ /*
+ if(isset($_POST['editGroupMembership'])){
+ $this->group_dialog = TRUE;
+ }
+
+ if(isset($_POST['add_groups_finish']) || isset($_POST['add_groups_cancel'])){
+ $this->execute();
+ $this->group_dialog =FALSE;
+ }
+
+ if($this->group_dialog){
+ return($this->execute());
+ }
+ */
+
+ $str ="
+ <table width='100%'>
+ <tr>
+ <td style='vertical-align:top;'>
+ <h2>"._("Posix settings")."</h2>
+ <table>
+ <tr>
+ <td>
+ <label for=\"homeDirectory\">"._("Home directory")."</label>
+ </td>
+ <td>
+ <input id=\"homeDirectory\" name=\"homeDirectory\" size=40 maxlength=120 value=\"".$this->homeDirectory."\">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input id=\"force_ids\" type=checkbox name=\"force_ids\" value=\"1\" ".$force_ids."}
+ onclick=\"changeState('uidNumber');changeState('gidNumber');\">
+ </td>
+ <td>
+ <label for=\"force_ids\">
+ "._("Force UID/GID")."
+ </label>
+ </td>
+ <td style=\"width:20px;\"></td>
+ <td>
+ <label for=\"uidNumber\">"._("UID")."</label>
+ </td>
+ <td>
+ <input id=\"uidNumber\" name=\"uidNumber\" size=5 maxlength=5 {$forceMode} value=\"".$this->uidNumber."\">
+ </td>
+ </tr>
+ <tr>
+ <td colspan=\"3\"></td>
+ <td>
+ <label for=\"gidNumber\">"._("GID")."</label>
+ </td>
+ <td>
+ <input id=\"gidNumber\" name=\"gidNumber\" size=5 maxlength=5 {$forceMode} value=\"".$this->gidNumber."\">
+ </td>
+ </tr>
+ <!--
+ <tr>
+ <td>
+ "._("Group membership")."
+ </td>
+ <td>
+ <input type='submit' name='editGroupMembership' value='"._("Edit")."'>
+ </td>
+ </tr>
+ -->
+ </table>
+ </td>
+ </tr>
+ </table>
+ ";
+ return($str);
+ }
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: