From: hickert Date: Fri, 11 Apr 2008 09:02:52 +0000 (+0000) Subject: Updated C&P for FAI. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6d7573648de097813245616c1027236001b34db3;p=gosa.git Updated C&P for FAI. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10349 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc index 0e5a17105..849643276 100644 --- a/gosa-plugins/fai/admin/fai/class_faiHook.inc +++ b/gosa-plugins/fai/admin/fai/class_faiHook.inc @@ -202,7 +202,7 @@ class faiHook extends plugin if(isset($this->SubObjects[base64_decode($_GET['getFAIHook'])])){ $obj = $this->SubObjects[base64_decode($_GET['getFAIHook'])]; $obj = $this->get_object_attributes($obj,$this->sub_Load_Later); - send_binary_content(stripslashes($obj['FAIscript']),$obj['cn'].".FAIhook"); + send_binary_content(stripslashes($obj['FAIhook']),$obj['cn'].".FAIhook"); } } @@ -453,6 +453,21 @@ class faiHook extends plugin /* Call common method to give check the hook */ $message= plugin::check(); + /* Ensure that we do not overwrite an allready existing entry + */ + if($this->is_new){ + $new_dn= 'cn='.$this->cn.",".get_ou('faihookou').get_ou('faiou').session::get('CurrentMainBase'); + $faifilter = session::get('faifilter'); + if($faifilter['branch']!="main"){ + $new_dn ='cn='.$this->cn.",".get_ou('faihookou').$faifilter['branch']; + } + + $res = faiManagement::check_class_name("FAIhook",$this->cn,$new_dn); + if(isset($res[$this->cn])){ + $message[] = msgPool::duplicated(_("Name")); + } + } + return ($message); } @@ -585,6 +600,34 @@ class faiHook extends plugin "description" => _("Description")) )); } + + + /*! \brief Used for copy & paste. + Returns a HTML input mask, which allows to change the cn of this entry. + @param Array Array containing current status && a HTML template. + */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn", htmlentities($this->cn)); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + /*! \brief Used for copy & paste. + Some entries must be renamed to avaoid duplicate entries. + */ + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = get_post('cn'); + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index b6ea43559..e855f8775 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -1189,6 +1189,21 @@ class faiManagement extends plugin } + /* Check if the given FAI class is used in this release + */ + static function check_class_name($oc,$name,$dn) + { + $base = FAI::get_release_dn($dn); + $res = FAI::get_all_objects_for_given_base($base,"(objectClass=".$oc.")",TRUE); + $delete = array(); + $used = array(); + foreach($res as $object){ + $used[$object['cn'][0]]= $object['cn'][0]; + } + return($used); + } + + /* Return plugin informations for acl handling */ static function plInfo() { diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc index 76f5cae5c..fe7989ea1 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPackage.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPackage.inc @@ -375,6 +375,20 @@ class faiPackage extends plugin $message[]=_("Please choose a valid release/section combination for your repository setup!"); } + /* Ensure that we do not overwrite an allready existing entry + */ + if($this->is_new){ + $new_dn= 'cn='.$this->cn.",".get_ou('faipackageou').get_ou('faiou').session::get('CurrentMainBase'); + $faifilter = session::get('faifilter'); + if($faifilter['branch']!="main"){ + $new_dn ='cn='.$this->cn.",".get_ou('faipackageou').$faifilter['branch']; + } + + $res = faiManagement::check_class_name("FAIpackageList",$this->cn,$new_dn); + if(isset($res[$this->cn])){ + $message[] = msgPool::duplicated(_("Name")); + } + } return ($message); } @@ -630,6 +644,32 @@ class faiPackage extends plugin } + /*! \brief Used for copy & paste. + Returns a HTML input mask, which allows to change the cn of this entry. + @param Array Array containing current status && a HTML template. + */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn", htmlentities($this->cn)); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + /*! \brief Used for copy & paste. + Some entries must be renamed to avaoid duplicate entries. + */ + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = get_post('cn'); + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc index 3179e4cb2..a3ed119a8 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc @@ -392,6 +392,20 @@ class faiPartitionTable extends plugin /* Call common method to give check the hook */ $message= plugin::check(); + /* Ensure that we do not overwrite an allready existing entry + */ + if($this->is_new){ + $new_dn= 'cn='.$this->cn.",".get_ou('faipartitionou').get_ou('faiou').session::get('CurrentMainBase'); + $faifilter = session::get('faifilter'); + if($faifilter['branch']!="main"){ + $new_dn ='cn='.$this->cn.",".get_ou('faipartitionou').$faifilter['branch']; + } + + $res = faiManagement::check_class_name("FAIpartitionTable",$this->cn,$new_dn); + if(isset($res[$this->cn])){ + $message[] = msgPool::duplicated(_("Name")); + } + } return ($message); } @@ -592,6 +606,34 @@ class faiPartitionTable extends plugin "description" => _("Description")) )); } + + + /*! \brief Used for copy & paste. + Returns a HTML input mask, which allows to change the cn of this entry. + @param Array Array containing current status && a HTML template. + */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn", htmlentities($this->cn)); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + /*! \brief Used for copy & paste. + Some entries must be renamed to avaoid duplicate entries. + */ + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = get_post('cn'); + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-plugins/fai/admin/fai/class_faiScript.inc b/gosa-plugins/fai/admin/fai/class_faiScript.inc index ab8ef9a19..d94b760c2 100644 --- a/gosa-plugins/fai/admin/fai/class_faiScript.inc +++ b/gosa-plugins/fai/admin/fai/class_faiScript.inc @@ -500,6 +500,21 @@ class faiScript extends plugin /* Call common method to give check the hook */ $message= plugin::check(); + /* Ensure that we do not overwrite an allready existing entry + */ + if($this->is_new){ + $new_dn= 'cn='.$this->cn.",".get_ou('faiscriptou').get_ou('faiou').session::get('CurrentMainBase'); + $faifilter = session::get('faifilter'); + if($faifilter['branch']!="main"){ + $new_dn ='cn='.$this->cn.",".get_ou('faiscriptou').$faifilter['branch']; + } + + $res = faiManagement::check_class_name("FAIscript",$this->cn,$new_dn); + if(isset($res[$this->cn])){ + $message[] = msgPool::duplicated(_("Name")); + } + } + return ($message); } @@ -628,6 +643,34 @@ class faiScript extends plugin $this->SubObjects[$objects['cn']] = $objects; } } + + + /*! \brief Used for copy & paste. + Returns a HTML input mask, which allows to change the cn of this entry. + @param Array Array containing current status && a HTML template. + */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn", htmlentities($this->cn)); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + /*! \brief Used for copy & paste. + Some entries must be renamed to avaoid duplicate entries. + */ + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = get_post('cn'); + } + } /* Return plugin informations for acl handling */ diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc index 0fdd00ed4..ab20b94bb 100644 --- a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc +++ b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc @@ -430,6 +430,21 @@ class faiTemplate extends plugin /* Call common method to give check the hook */ $message= plugin::check(); + /* Ensure that we do not overwrite an allready existing entry + */ + if($this->is_new){ + $new_dn= 'cn='.$this->cn.",".get_ou('faitemplateou').get_ou('faiou').session::get('CurrentMainBase'); + $faifilter = session::get('faifilter'); + if($faifilter['branch']!="main"){ + $new_dn ='cn='.$this->cn.",".get_ou('faitemplateou').$faifilter['branch']; + } + + $res = faiManagement::check_class_name("FAItemplate",$this->cn,$new_dn); + if(isset($res[$this->cn])){ + $message[] = msgPool::duplicated(_("Name")); + } + } + return ($message); } @@ -565,6 +580,34 @@ class faiTemplate extends plugin "description" => _("Description")) )); } + + + /*! \brief Used for copy & paste. + Returns a HTML input mask, which allows to change the cn of this entry. + @param Array Array containing current status && a HTML template. + */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn", htmlentities($this->cn)); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + /*! \brief Used for copy & paste. + Some entries must be renamed to avaoid duplicate entries. + */ + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = get_post('cn'); + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-plugins/fai/admin/fai/class_faiVariable.inc b/gosa-plugins/fai/admin/fai/class_faiVariable.inc index 53bf6706b..21722813e 100644 --- a/gosa-plugins/fai/admin/fai/class_faiVariable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiVariable.inc @@ -321,6 +321,21 @@ class faiVariable extends plugin /* Call common method to give check the hook */ $message= plugin::check(); + /* Ensure that we do not overwrite an allready existing entry + */ + if($this->is_new){ + $new_dn= 'cn='.$this->cn.",".get_ou('faivariableou').get_ou('faiou').session::get('CurrentMainBase'); + $faifilter = session::get('faifilter'); + if($faifilter['branch']!="main"){ + $new_dn ='cn='.$this->cn.",".get_ou('faivariableou').$faifilter['branch']; + } + + $res = faiManagement::check_class_name("FAIvariable",$this->cn,$new_dn); + if(isset($res[$this->cn])){ + $message[] = msgPool::duplicated(_("Name")); + } + } + return ($message); } @@ -452,6 +467,34 @@ class faiVariable extends plugin "description" => _("Description")) )); } + + + /*! \brief Used for copy & paste. + Returns a HTML input mask, which allows to change the cn of this entry. + @param Array Array containing current status && a HTML template. + */ + function getCopyDialog() + { + $vars = array("cn"); + $smarty = get_smarty(); + $smarty->assign("cn", htmlentities($this->cn)); + $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); + $ret = array(); + $ret['string'] = $str; + $ret['status'] = ""; + return($ret); + } + + + /*! \brief Used for copy & paste. + Some entries must be renamed to avaoid duplicate entries. + */ + function saveCopyDialog() + { + if(isset($_POST['cn'])){ + $this->cn = get_post('cn'); + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: