diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc
index 8681765774f3a44ff2e176da0405c8434128cdd5..4380ba3c7a10ec1bc44349d5393c21e9e5cf1f76 100644 (file)
if($dn != "new"){
$this->dn =$dn;
- /* Get FAIstate */
- if(isset($this->attrs['FAIstate'][0])){
- $this->FAIstate = $this->attrs['FAIstate'][0];
- }
-
/* Check if there are already some packages in this list
*/
$this->usedPackages = array();
if(isset($this->attrs['FAIpackage'])){
unset($this->attrs['FAIpackage']['count']);
foreach($this->attrs['FAIpackage'] as $pkg){
- $name = preg_replace("/^\-/","",$pkg);
+ $name = preg_replace("/\-$/","",$pkg);
$this->usedPackages[$name] = $pkg;
}
ksort($this->usedPackages);
/* Assemble release name */
$release = $this->parent->parent->fai_release;
- $tmp= preg_replace('/[,]*'.normalizePreg(get_ou('faiou')).'.*$/', '', $release);
+ $tmp= preg_replace('/[,]*'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/', '', $release);
$tmp= preg_replace('/ou=/', '', $tmp);
$rev= array_reverse(split(',', $tmp));
$this->FAIdebianRelease= "/";
******/
/* + was pressed to open the package dialog */
- if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage")){
+ 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;
}
* Mark as removed
******/
- if(!preg_match('/^freeze/', $this->FAIstate) && preg_match("/^removal_package_/",$name)){
+ if(!preg_match('/freeze/i', $this->FAIstate) && preg_match("/^removal_package_/",$name)){
$id = @base64_decode(preg_replace("/^removal_package_(.*)_[xy]*$/","\\1",$name));
if(isset($this->usedPackages[$id])){
$pkg = $this->usedPackages[$id];
- if (preg_match('/^-/', $pkg)){
- $pkg= preg_replace('/^-/', '', $pkg);
+ if (preg_match('/\-$/', $pkg)){
+ $pkg= preg_replace('/\-$/', '', $pkg);
} else {
- $pkg= preg_replace('/^/', '-', $pkg);
+ $pkg= preg_replace('/$/', '-', $pkg);
}
$this->usedPackages[$id] = $pkg;
}
/******
* Delete Pkgs
******/
- if(!preg_match('/^freeze/', $this->FAIstate) && preg_match("/^remove_package_/",$name)){
+ if(!preg_match('/freeze/i', $this->FAIstate) && preg_match("/^remove_package_/",$name)){
$id = @base64_decode(preg_replace("/^remove_package_(.*)_[xy]*$/","\\1",$name));
-
if(isset($this->usedPackages[$id])){
- $this->usedPackages[$id];
+ unset($this->usedPackages[$id]);
}
break;
}
/******
* Configure Pkgs
******/
- if(!preg_match('/^freeze/', $this->FAIstate) && preg_match("/^configure_package_/",$name)){
+ if(!preg_match('/freeze/i', $this->FAIstate) && preg_match("/^configure_package_/",$name)){
$pkg = @base64_decode(preg_replace("/^configure_package_(.*)_[xy]*$/","\\1",$name));
if(isset($this->usedPackages[$pkg])){
/* attach new packages */
if(isset($_POST['SaveSubObject'])) {
- if(!preg_match("/^freeze/", $this->FAIstate)){
+ if(!preg_match("/freeze/i", $this->FAIstate)){
$this->dialog->save_object();
if(count($this->dialog->check())){
foreach($this->dialog->check() as $msgs){
ksort($this->usedPackages);
if(is_array($this->usedPackages)){
foreach($this->usedPackages as $usedName => $name){
+
+ $actions = "";
/* Append message if package is configured */
$configured = "<img src='images/empty.png' alt=' ' class='center'>";
if(isset($this->ConfiguredPackages[$usedName])){
- $configured = "<img src='images/package_configure.png' alt='"._("Configured")."'
+ $configured = "<img src='plugins/fai/images/package_configure.png' alt='"._("Configured")."'
title='"._("Configured")."' class='center'>";
}
/* Adapt used name if we're marked for removal */
$removal = "<img src='images/empty.png' alt=' ' class='center'>";
- if (preg_match('/^-/', $name)){
- $removal = "<img src='images/negate.png' alt='"._("Package marked for removal")."'
+ if (preg_match('/\-$/', $name)){
+ $removal = "<img src='plugins/fai/images/removal_mark.png' alt='"._("Package marked for removal")."'
title='"._("Package marked for removal")."' class='center'>";
}
/* Get Version */
- $version = "";
+ $version = " ";
if(isset($this->list[$usedName]['VERSION'])){
$version = $this->list[$usedName]['VERSION'];
}
/* Get description */
- $description = "";
+ $description = " ";
if(isset($this->list[$usedName]['DESCRIPTION'])){
- $description = $this->list[$usedName]['DESCRIPTION'];
+ $description = base64_decode($this->list[$usedName]['DESCRIPTION']);
+ }
+
+ if(!preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIpackage")){
+ $actions = "<input type='image' class='center' title='"._("Mark package for removal")."'
+ src='plugins/fai/images/removal_mark.png' name='removal_package_".base64_encode($usedName)."' >";
+ }
+
+ if(isset($this->list[$usedName]['TEMPLATE']) &&
+ !preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIdebconfInfo")){
+ $actions.= " <input type='image' class='center' title='"._("Configure this package")."'
+ src='plugins/fai/images/package_configure.png' name='configure_package_".base64_encode($usedName)."' >";
+ }
+ if(!preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIpackage")){
+ $actions.= " <input type='image' class='center' title='"._("Remove this package")."'
+ src='images/lists/trash.png' name='remove_package_".base64_encode($usedName)."' >";
}
-
- $actions = "<input type='image' class='center' title='"._("Mark package for removal")."'
- src='images/negate.png' name='removal_package_".base64_encode($usedName)."' >";
- $actions.= " <input type='image' class='center' title='"._("Configure this package")."'
- src='images/package_configure.png' name='configure_package_".base64_encode($usedName)."' >";
- $actions.= " <input type='image' class='center' title='"._("Remove this package")."'
- src='images/lists/trash.png' name='remove_package_".base64_encode($usedName)."' >";
$field1 = array("string" => $configured." ".$removal,"attach" => "style='width:40px;'");
$field2 = array("string" => $usedName ,"attach" => "style='width:200px;'");
foreach($tmp['plProvidedAcls'] as $name => $translated){
$smarty->assign($name."ACL",$this->getacl($name,preg_match("/freeze/",$this->FAIstate)));
}
-
+
+ $smarty->assign("freeze", preg_match("/freeze/",$this->FAIstate));
$smarty->assign("divlist",$divlist->DrawList());
$smarty->assign("release" ,$this->FAIdebianRelease);
$smarty->assign("sections",$this->sections);
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->dn);
$release = $this->parent->parent->fai_release;
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $this->dn);
+ $use_dn = preg_replace("/".preg_quote(FAI::get_release_dn($this->dn), '/')."/i", $release, $this->dn);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
new log("remove","fai/".get_class($this),$use_dn,$this->attributes);
foreach($this->ConfiguredPackages as $pkgname => $attrs){
foreach($attrs as $name => $attr){
$pkgdn = "FAIvariable=".$name.",".$this->dn;
- $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $release, $pkgdn);
+ $use_dn = preg_replace("/".preg_quote(FAI::get_release_dn($this->dn), '/')."/i", $release, $pkgdn);
FAI::prepare_to_save_FAI_object($use_dn,array(),true);
}
}
*/
if($this->is_new){
$release = $this->parent->parent->fai_release;
- $new_dn= 'cn='.$this->cn.",".get_ou('faipackageou').get_ou('faiou').$release;
+ $new_dn= 'cn='.$this->cn.",".get_ou('faiPackageRDN').get_ou('faiBaseRDN').$release;
$res = faiManagement::check_class_name("FAIpackageList",$this->cn,$new_dn);
if(isset($res[$this->cn])){
$message[] = msgPool::duplicated(_("Name"));
*/
function genPkgs($force = false)
{
+ if(empty($this->FAIdebianRelease)) return;
+
if(!count($this->buffer) || $force){
$q = new gosaSupportDaemon();
- $attrs = array("distribution", "package","version", "section", "description", "timestamp");
+ $attrs = array("distribution", "package","version", "section", "description", "timestamp","template");
$packages = array_keys($this->usedPackages);
if($this->FAIdebianRelease == "ClearFromCopyPaste"){
$current_release = $this->parent->parent->fai_release;
- $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $current_release);
+ $tmp= preg_replace('/,'.preg_quote(get_ou('faiBaseRDN'), '/').'.*$/', '', $current_release);
$tmp= preg_replace('/ou=/', '', $tmp);
$rev= array_reverse(split(',', $tmp));
$this->FAIdebianRelease= "";