summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 583e869)
raw | patch | inline | side by side (parent: 583e869)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 13 Nov 2006 07:49:10 +0000 (07:49 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 13 Nov 2006 07:49:10 +0000 (07:49 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5076 594d385d-05f5-0310-b6e9-bd551577e9d8
index f1111e60d92f50f3a79146fdbb3781bced8bf754..4637552b7c79021b8adf3c17556faa195ab25c1d 100644 (file)
$this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
$this->AddHeader(array("string" => _("Name of FAI class"), "attach" => "style=''"));
$this->AddHeader(array("string" => _("Class type"), "attach" => "style='width:200px;'"));
- $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
+ $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:80px;border-right:0px;text-align:right;'"));
$this->AddCheckBox("ShowProfiles" , _("Display FAI profile objects") ,_("Show profiles") ,true);
$this->AddCheckBox("ShowTemplates" , _("Display FAI template objects") ,_("Show templates") ,true);
}
}
- /* Create listhead, it will be shown on top of the divlist.
+
+
+
+ /* Get copy & paste icon */
+ if($this->parent->CopyPasteHandler){
+ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
+ }else{
+ $Copy_Paste ="";
+ }
+
+ /* Create listhead, it will be shown on top of the divlist.
* It provides general navigation and object creation
*/
$listhead =
" <input class='center' type='image' src='images/fai_new_packages.png' align='middle'
title='"._("New package list")."' name='Create_package' alt='"._("PK")."'> ".
+ $Copy_Paste.
+
" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
_("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
$desc= "";
}
+ /* Create action icons */
+ $action ="";
+ if($this->parent->CopyPasteHandler){
+ $action .= "<input class='center' type='image'
+ src='images/editcut.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")."'> ";
+ }
+
if($value['FAIstate'] == "freeze"){
- $action = "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
+ $action .= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
name='entry_edit_%KEY%' title='"._("Edit class")."'>";
$edi = $editlink;
$acti = $action;
}else{
- $action = "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
+ $action .= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
name='entry_edit_%KEY%' title='"._("Edit class")."'>";
$action .= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
name='entry_delete_%KEY%' title='"._("Delete class")."'>";
$edi = $editlink;
}
+
+
$field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'");
$field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$value['cn'].$desc,preg_replace('/ /', ' ', @LDAP::fix($value['dn']))),$edi) , "attach" => "style=''");
$field3 = array("string" => $info, "attach" => "style='width:200px;'");
- $field4 = array("string" => preg_replace("/%KEY%/",$key,$acti) , "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+ $field4 = array("string" => preg_replace("/%KEY%/",$key,$acti) , "attach" => "style='width:80px;border-right:0px;text-align:right;'");
$this->AddElement(array($field1,$field2,$field3,$field4));
}
}
index 75555fd0134bcadbc7ac6939cc9bb8793d02754e..6fa2680a2a8023e909bbbb862be696e9cef562b6 100644 (file)
var $SubObjects = array(); // All leafobjects of this object
var $FAIstate = "";
+ var $base = "";
+ var $release = "";
+ var $copy_paste_mode = false;
function faiHook ($config, $dn= NULL)
{
/* Call common method to give check the hook */
$message= plugin::check();
+ /* If this is a new script, check if a script with this name already exists */
+ if(!empty($this->release) && $this->copy_paste_mode){
+
+ /* Check if current name is already used for fai scripts in selected release */
+ $dn = 'cn='.$this->cn.",ou=hooks,".$this->release;
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ if($ldap->count()){
+
+ $r =convert_department_dn($this->release);;
+ $message[] = sprintf(_("Can't insert a fai hook named '%s' in '%s' there is already a hook with the given name."),$this->cn,$r);
+ }
+ }
return ($message);
}
index cf0bae1c5cc724cf5f94a1357c84fa64d50cdd59..83e4c11ade6563e51a80286702d8bf19d004995d 100644 (file)
var $dispNewBranch= false;
var $dispNewFreeze= false;
-
var $DivListFai;
+ var $CopyPasteHandler = NULL;
/* construction/reconstruction
*/
/* Creat dialog object */
$this->DivListFai = new divListFai($this->config,$this);
$this->DivListFai->AvailableBranches = $this->getBranches();
+
+ /* Copy & Paste handler */
+ if ($this->config->boolValueIsTrue("main", "enableCopyPaste")){
+ $this->CopyPasteHandler= new CopyPasteHandler($this->config);
+ }
}
function execute()
$s_entry = preg_replace("/_.*$/","",$s_entry);
$s_action = "delete";
}
+
+ /* Check for Copy & Paste actions */
+ foreach(array( "editPaste" => "editPaste",
+ "copy" => "copy",
+ "cut" => "cut") as $act => $action){
+ if (preg_match("/".$act.".*/", $name)){
+ $s_action= $action;
+ $s_entry= preg_replace("/".$act."_/i", "", $name);
+ $s_entry = preg_replace("/_.*$/","",$s_entry);
+ break;
+ }
+ }
}
if(isset($_GET['edit_entry'])){
$this->dispNewFreeze = false;
}
+ /* Display the copy & paste dialog, if it is currently open */
+ $ret = $this->copyPasteHandling($s_action,$s_entry);
+ if($ret){
+ return($ret);
+ }
/****************
Delete confirme dialog
return ($ret);
}
+
+ /* Perform copy & paste requests
+ If copy&paste is in progress this returns a dialog to fix required attributes
+ */
+ function copyPasteHandling($s_action,$s_entry)
+ {
+ /* Only perform copy/paste if it is enabled */
+ if($this->CopyPasteHandler){
+
+ /* Prepare current object to be pasted */
+ if( $s_action == "editPaste" || $this->CopyPasteHandler->stillOpen()){
+
+ $this->CopyPasteHandler->save_object();
+ $this->CopyPasteHandler->SetVar("base", $this->DivListFai->selectedBase);
+ $this->CopyPasteHandler->SetVar("copy_paste_mode", TRUE);
+
+ $release = $_SESSION['CurrentMainBase'];
+ if($_SESSION['faifilter']['branch']!="main"){
+ $release = $_SESSION['faifilter']['branch'];
+ }
+ $this->CopyPasteHandler->SetVar("release", $release);
+
+ /* Execute copy & paste dialog and display returned data, normaly a dialog which allows
+ us to solve all attribute mismatches for this object.
+ If nothing is returned, copy & paste was succesfully or aborted */
+ if(($ret= $this->CopyPasteHandler->execute())){
+ return ($ret);
+ }
+
+ /* Use the last dn to search for it's ID in the newly generated list. */
+ $dn= $this->CopyPasteHandler->lastdn;
+
+ /* Get new list */
+ $this->reload();
+ foreach($this->objects as $id => $entry){
+ if($entry['dn'] == $dn){
+ $s_entry= $id;
+ break;
+ }
+ }
+ }
+
+ /* Copy selected object
+ Create a new empty object and the current selected object.
+ Send both to copy&paste class*/
+ if($s_action == "copy"){
+ $this->CopyPasteHandler->Clear();
+
+ $dn= $this->objects[$s_entry]['dn'];
+ $acl= get_permissions ($dn, $this->ui->subtreeACL);
+
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ $attr = $ldap->fetch();
+ $tmp = $this->get_type($attr);
+
+ if(!count($tmp) == 3 ) return;
+
+ $tabs = $tmp[0];
+ $class = $tmp[1];
+ $data = $tmp[2];
+
+ $obj = new $tabs($this->config, $this->config->data['TABS'][$data], $dn);
+ $objNew = new $tabs($this->config, $this->config->data['TABS'][$data], "new");
+ $obj-> set_acl($acl);
+ $objNew-> set_acl($acl);
+ $this->CopyPasteHandler->Copy($obj,$objNew);
+ }
+
+ /* Cut selected object.
+ Open user object and send it to the copy & paste handler */
+ if($s_action == "cut"){
+ $this->CopyPasteHandler->Clear();
+ $dn= $this->objects[$s_entry]['dn'];
+ $acl= get_permissions ($dn, $this->ui->subtreeACL);
+
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ $attr = $ldap->fetch();
+ $tmp = $this->get_type($attr);
+
+ if(!count($tmp) == 3 ) return;
+
+ $tabs = $tmp[0];
+ $class = $tmp[1];
+ $data = $tmp[2];
+ $obj= new $tabs($this->config, $this->config->data['TABS'][$data], $dn);
+ $obj->set_acl($acl);
+ $this->CopyPasteHandler->Cut($obj);
+ }
+ }
+ }
+
+
+
/* reload list of objects */
function reload()
{
index d2fe6bac321db3ae79789cea38e31bdb74b915f7..e2e112dc92e09ecef13c9d6b078a4bbd38c402d3 100644 (file)
"hold", "clean", "aptitude", "aptitude-r",
"pending", "dpkgc" );
+ var $base = "";
+ var $release = "";
+ var $copy_paste_mode = false;
function faiPackage ($config, $dn= NULL)
{
$message[]=_("Please choose a valid combination for your repository setup.");
}
+ /* If this is a new script, check if a script with this name already exists */
+ if(!empty($this->release) && $this->copy_paste_mode){
+
+ /* Check if current name is already used for fai scripts in selected release */
+ $dn = 'cn='.$this->cn.",ou=packages,".$this->release;
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ if($ldap->count()){
+
+ $r =convert_department_dn($this->release);;
+ $message[] = sprintf(_("Can't insert a fai package list named '%s' in '%s' there is already a package list with the given name."),$this->cn,$r);
+ }
+ }
return ($message);
}
+
function printUsedPackages(){
$a_ret=array();
if(is_array($this->usedPackages)) {
diff --git a/plugins/admin/fai/class_faiPartitionTable.inc b/plugins/admin/fai/class_faiPartitionTable.inc
index 64604d971970b42c4b78f5aab606f88a2a8b3d98..f5ca9f7b1ec3568fbdfc860c86543c8293db9232 100644 (file)
var $dialog = NULL; // a dialog, e.g. new disk dialog
var $FAIstate = "";
+ var $base = "";
+ var $release = "";
+ var $copy_paste_mode = false;
function faiPartitionTable ($config, $dn= NULL)
{
/* Call common method to give check the hook */
$message= plugin::check();
+ /* If this is a new script, check if a script with this name already exists */
+ if(!empty($this->release) && $this->copy_paste_mode){
+
+ /* Check if current name is already used for fai scripts in selected release */
+ $dn = 'cn='.$this->cn.",ou=disk,".$this->release;
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ if($ldap->count()){
+
+ $r =convert_department_dn($this->release);;
+ $message[] = sprintf(_("Can't insert a new fai partition table named '%s' in '%s' there is already one defined with the given name."),$this->cn,$r);
+ }
+ }
return ($message);
}
index 7a6640330c4a57b002ada5d0f8b1f7ead13915ad..92969c28582859ddbe39f613c3e3af9b531bfd4c 100644 (file)
var $FAIclasses = array(); // Contains classname seperated in an array
var $FAIAllclasses = array(); // Contains all possible Classnames
- var $FAIstate = "";
+ var $FAIstate = "";
+ var $base = "";
+ var $release = "";
+ var $copy_paste_mode= false;
+
+ var $CopyPasteVars = array("FAIclass","FAIclasses","FAIAllclasses","FAIstate");
function faiProfile($config, $dn= NULL)
{
/* Get ldap connection */
$ldap= $this->config->get_ldap_link();
$ldap->cd($base);
-
+ $sort = array();
/* Capture objects from given base */
$result = array();
foreach($ObjectTypes as $oc => $data){
}
$ldap = $this->config->get_ldap_link();
- $ldap->cd($_SESSION['CurrentMainBase']);
+ $release = "ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+ if($_SESSION['faifilter']['branch']!="main"){
+ $release = "ou=profiles,".$_SESSION['faifilter']['branch'];
+ }
+ $ldap->cd($release);
if ($this->old_cn == ""){
$ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn."))",array("*"));
} else {
$ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*"));
}
-
if($ldap->count()){
$message[]=_("There is already a profile with this class name defined.");
}
-
+
return ($message);
}
index ee8c3c5c143e4157edee795e4d1be61599353aa1..935b771b2b6d1e17d35c5c76b8d8c9af09be8e4a 100644 (file)
var $FAIstate ="";
+ var $base ="";
+ var $release ="";
+ var $copy_paste_mode = false;
+
function faiScript ($config, $dn= NULL)
{
/* Load Attributes */
/* Call common method to give check the hook */
$message= plugin::check();
+ /* If this is a new script, check if a script with this name already exists */
+ if(!empty($this->release) && $this->copy_paste_mode){
+
+ /* Check if current name is already used for fai scripts in selected release */
+ $dn = 'cn='.$this->cn.",ou=scripts,".$this->release;
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ if($ldap->count()){
+
+ $r =convert_department_dn($this->release);;
+ $message[] = sprintf(_("Can't insert a script named '%s' in '%s' there is already a script with the given name."),$this->cn,$r);
+ }
+ }
return ($message);
}
index 8e7cf40054ce44b78d31b99f077a137a2c051c89..e34f5d4bb275f8dc4c4eb5dda020361fc022735a 100644 (file)
var $SubObjects = array(); // All leafobjects of this object
var $FAIstate = "";
+ var $base = "";
+ var $release = "";
+ var $copy_paste_mode = false;
function faiTemplate ($config, $dn= NULL)
{
/* Call common method to give check the hook */
$message= plugin::check();
+ /* If this is a new script, check if a script with this name already exists */
+ if(!empty($this->release) && $this->copy_paste_mode){
+
+ /* Check if current name is already used for fai scripts in selected release */
+ $dn = 'cn='.$this->cn.",ou=templates,".$this->release;
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ if($ldap->count()){
+
+ $r =convert_department_dn($this->release);;
+ $message[] = sprintf(_("Can't insert a fai template named '%s' in '%s' there is already a template with the given name."),$this->cn,$r);
+ }
+ }
return ($message);
}
index 1c596cb50dd73d913a81b31be0722c74106bacb5..4b10b70e4f2bf530972723bbfcc380834705ca8f 100644 (file)
var $SubObjects = array(); // All leafobjects of this object
var $FAIstate = "";
+ var $base = "";
+ var $release = "";
+ var $copy_paste_mode = false;
function faiVariable ($config, $dn= NULL)
{
/* Call common method to give check the hook */
$message= plugin::check();
+ /* If this is a new script, check if a script with this name already exists */
+ if(!empty($this->release) && $this->copy_paste_mode){
+
+ /* Check if current name is already used for fai scripts in selected release */
+ $dn = 'cn='.$this->cn.",ou=variables,".$this->release;
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($dn);
+ if($ldap->count()){
+
+ $r =convert_department_dn($this->release);;
+ $message[] = sprintf(_("Can't insert a fai variable named '%s' in '%s' there is already a variable with the given name."),$this->cn,$r);
+ }
+ }
return ($message);
}