diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc
index a18c3c8eaf9761d7d8aa83a7766b4a3b90843bb9..d32f26a64d41e27de24dc2c150bd47363a5deaee 100644 (file)
var $base;
var $FAIpackage ;
var $base;
var $FAIpackage ;
+ var $packageSelect ;
+
var $FAIinstallMethods = array( "install", "ninstall", "remove",
"dselect-upgrade", "taskinst", "taskrm",
"hold", "clean", "aptitude", "aptitude-r",
var $FAIinstallMethods = array( "install", "ninstall", "remove",
"dselect-upgrade", "taskinst", "taskrm",
"hold", "clean", "aptitude", "aptitude-r",
/* Assemble release name */
$release = $this->parent->parent->fai_release;
/* Assemble release name */
$release = $this->parent->parent->fai_release;
- $tmp= preg_replace('/[,]*'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/', '', $release);
+ $tmp= preg_replace('/[,]*'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/i', '', $release);
$tmp= preg_replace('/ou=/', '', $tmp);
$tmp= preg_replace('/ou=/', '', $tmp);
- $rev= array_reverse(split(',', $tmp));
+ $rev= array_reverse(explode(',', $tmp));
$this->FAIdebianRelease= "/";
foreach ($rev as $part){
$this->FAIdebianRelease.= "/$part";
$this->FAIdebianRelease= "/";
foreach ($rev as $part){
$this->FAIdebianRelease.= "/$part";
}
}
}
}
- /* + was pressed to open the package dialog */
- if(isset($_POST['Addpkg']) &&
- $this->acl_is_writeable("FAIpackage") &&
- !preg_match("/freeze/",$this->FAIstate)){
- $this->dialog = new faiPackageEntry($this->config, $this->FAIdebianRelease,$this->usedPackages);
- $this->is_dialog =true;
+ // Open the packageSelect dialog to allow adding packages out of a list.
+ if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage") && !preg_match("/freeze/",$this->FAIstate)){
+ $this->packageSelect = new packageSelect($this->config, get_userinfo());
+ session::set('packageSelect_Release',$this->FAIdebianRelease);
+ $this->dialog =true;
+ }
+
+ // Close packageSelect dialog.
+ if(isset($_POST['packageSelect_cancel'])){
+ $this->packageSelect = FALSE;
+ $this->dialog =FALSE;
+ }
+
+ // Close packageSelect dialog and add the selected packages.
+ if(isset($_POST['packageSelect_save']) && $this->packageSelect instanceOf packageSelect){
+ if(!preg_match("/freeze/i", $this->FAIstate)){
+ $use = $this->packageSelect->save();
+
+ foreach($use as $pkg){
+ $item = array();
+ for($i =0; $i < $pkg['count']; $i++){
+ $item[$pkg[$i]] = $pkg[$pkg[$i]][0];
+ }
+ $this->usedPackages[$item['PACKAGE']] = $item['PACKAGE'];
+ }
+
+ ksort($this->usedPackages);
+
+ /* Generate package list */
+ $this->list= $this->genPkgs(TRUE);
+ }
+ $this->packageSelect = FALSE;
+ $this->dialog =FALSE;
+ }
+
+ // Display package add dialog
+ if($this->packageSelect instanceOf packageSelect){
+
+ session::set('filterBlacklist', array('PACKAGE' => $this->usedPackages));
+ return $this->packageSelect->execute();
}
}
$this->is_dialog=false;
}
$this->is_dialog=false;
}
- /* attach new packages */
- if(isset($_POST['SaveSubObject'])) {
- if(!preg_match("/freeze/i", $this->FAIstate)){
- $this->dialog->save_object();
- if(count($this->dialog->check())){
- foreach($this->dialog->check() as $msgs){
- msg_dialog::display(_("Error"), $msgs, ERROR_DIALOG);
- }
- }else{
- $use = $this->dialog->save();
- $this->usedPackages = $use;
- $this->dialog = false;
- $this->is_dialog=false;
- ksort($this->usedPackages);
-
- /* Generate package list */
- $this->list= $this->genPkgs(TRUE);
- }
- }else{
- $this->dialog = false;
- $this->is_dialog=false;
- }
- }
-
/* Save Configuration */
if(isset($_POST['SaveObjectConfig'])){
if(!preg_match("/^freeze/", $this->FAIstate)){
/* Save Configuration */
if(isset($_POST['SaveObjectConfig'])){
if(!preg_match("/^freeze/", $this->FAIstate)){
if($this->FAIdebianRelease == "ClearFromCopyPaste"){
$current_release = $this->parent->parent->fai_release;
if($this->FAIdebianRelease == "ClearFromCopyPaste"){
$current_release = $this->parent->parent->fai_release;
- $tmp= preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/', '', $current_release);
+ $tmp= preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/i', '', $current_release);
$tmp= preg_replace('/ou=/', '', $tmp);
$tmp= preg_replace('/ou=/', '', $tmp);
- $rev= array_reverse(split(',', $tmp));
+ $rev= array_reverse(explode(',', $tmp));
$this->FAIdebianRelease= "";
foreach ($rev as $part){
$this->FAIdebianRelease.= "/$part";
$this->FAIdebianRelease= "";
foreach ($rev as $part){
$this->FAIdebianRelease.= "/$part";
if(isset($attrs['FAIrepository'])){
for($i =0 ; $i < $attrs['FAIrepository']['count']; $i++){
$obj = $attrs['FAIrepository'][$i];
if(isset($attrs['FAIrepository'])){
for($i =0 ; $i < $attrs['FAIrepository']['count']; $i++){
$obj = $attrs['FAIrepository'][$i];
- $tmp = split("\|",$obj);
+ $tmp = explode("|",$obj);
if(count($tmp)==4){
if(count($tmp)==4){
- foreach(split(",",$tmp[3]) as $sec){
+ foreach(explode(",",$tmp[3]) as $sec){
if(!empty($sec)){
$ret[$tmp[2]][] = $sec;
}
if(!empty($sec)){
$ret[$tmp[2]][] = $sec;
}