summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f41cf0c)
raw | patch | inline | side by side (parent: f41cf0c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Oct 2005 10:03:37 +0000 (10:03 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 6 Oct 2005 10:03:37 +0000 (10:03 +0000) |
This line, and those below, will be ignored--
M fai/class_faiPackageEntry.inc
M fai/class_faiPackage.inc
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1505 594d385d-05f5-0310-b6e9-bd551577e9d8
M fai/class_faiPackageEntry.inc
M fai/class_faiPackage.inc
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1505 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_faiPackage.inc | patch | blob | history | |
plugins/admin/fai/class_faiPackageEntry.inc | patch | blob | history |
index eb27521f5c591d5c891999b72a8ba5c20b71c9c7..1688637e148cf0adb3d448ea50d77c022855a2e0 100644 (file)
var $mirrors = array(); // The combination of server/section/release
var $confDir = "";
+ var $usedPackages = array();
function faiPackage ($config, $dn= NULL)
{
$this->dn =$dn;
}
+ unset($this->attrs['FAIpackage']['count']);
+ foreach($this->attrs['FAIpackage'] as $pkg){
+ $this->usedPackages[] = $pkg;
+ }
$this->confDir = CONFIG_DIR."/fai/";
$this->FAIpackage = "test";
}
$smarty->assign($attrs,$this->$attrs);
}
- /* Second try */
+ $this->genMirror();
+
+ $availableServer = array();
+ foreach($this->mirrors as $mir){
+ if(($mir['section'] == $this->section)&&($mir['release']==$this->release)){
+ $availableServer[$mir['mirror']]=$mir['mirror'];
+ }
+ }
+
+ if(isset($_POST['Addpkg'])){
+ $this->dialog = new faiPackageEntry($this->config, $this->dn,$this->confDir.$this->mirror."/".$this->section."/".$this->release,$this->usedPackages);
+ $this->is_dialog =true;
+ }
+
+ if(isset($_POST['CancelSubObject'])){
+ $this->dialog = false;
+ $this->is_dialog=false;
+ }
+
+ if(isset($_POST['SaveSubObject'])) {
+ $this->dialog->save_object();
+ if(count($this->dialog->check())){
+ foreach($this->dialog->check() as $msgs){
+ print_red($msgs);
+ }
+ }else{
+ $use = $this->dialog->save();
+ $this->usedPackages = $use;
+ $this->dialog = false;
+ $this->is_dialog=false;
+ }
+ }
+
+ if($this->is_dialog){
+ return $this->dialog->execute();
+ }
- /* Check available server entries in CONFIG_DIR/fai
- */
+
+ $smarty->assign("mirrors" ,$availableServer);
+ $smarty->assign("mirror" ,$this->mirror);
+ $smarty->assign("sections",$this->sections);
+ $smarty->assign("section" ,$this->section);
+ $smarty->assign("releases",$this->releases);
+ $smarty->assign("release" ,$this->release);
+ $smarty->assign("usedPackages",$this->printUsedPackages());
+ $display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE));
+ return($display);
+ }
+
+ function genMirror(){
$confDir = $this->confDir;
if(!is_readable($confDir)){
print_red(sprintf(_("Can't read configuration folder '%s'."),$confDir));
fclose($fd);
}
- $availableServer = array();
- foreach($this->mirrors as $mir){
- if(($mir['section'] == $this->section)&&($mir['release']==$this->release)){
- $availableServer[$mir['mirror']]=$mir['mirror'];
- }
- }
-
- if(isset($_POST['Addpkg'])){
- $this->dialog = new faiPackageEntry($this->config, $this->dn,$this->confDir.$this->mirror."/".$this->section."/".$this->release);
- $this->is_dialog =true;
- }
-
- if($this->is_dialog){
- return $this->dialog->execute();
- }
-
- $smarty->assign("mirrors" ,$availableServer);
- $smarty->assign("mirror" ,$this->mirror);
- $smarty->assign("sections",$this->sections);
- $smarty->assign("section" ,$this->section);
- $smarty->assign("releases",$this->releases);
- $smarty->assign("release" ,$this->release);
- $smarty->assign("usedPackages",$this->usedPackages);
- $display.= $smarty->fetch(get_template_path('faiPackage.tpl', TRUE));
- return($display);
}
/* Delete me, and all my subtrees
return ($message);
}
+ function printUsedPackages(){
+ $a_ret=array();
+ if(is_array($this->usedPackages)) {
+ foreach($this->usedPackages as $usedName){
+ $a_ret[$usedName] = $usedName;
+ }
+ }
+ return($a_ret);
+ }
/* Save to LDAP */
function save()
plugin::save();
$ldap = $this->config->get_ldap_link();
-
+
+ $this->attrs['FAIpackage'] = array();
+ foreach($this->usedPackages as $pkg => $obj){
+ $this->attrs['FAIpackage'][] = $pkg;
+ }
+
+ unset($this->attrs['section']);
+ unset($this->attrs['mirror']);
+ unset($this->attrs['release']);
+
$ldap->cat($this->dn);
if($ldap->count()!=0){
/* Write FAIscript to ldap*/
diff --git a/plugins/admin/fai/class_faiPackageEntry.inc b/plugins/admin/fai/class_faiPackageEntry.inc
index 954cbd77b28d4fa50ebb4759a48434b5babeb311..006462389081a5935c7f277ba3a3634ba32a1e48 100644 (file)
var $buffer = array();
var $categories = array();
var $searchStr = "*";
+ var $selected = array();
/* Array with available class names */
var $FAIAllclasses = array();
- function faiPackageEntry ($config, $dn= NULL,$strID=false)
+ function faiPackageEntry ($config, $dn= NULL,$strID=false,$selected=array())
{
plugin::plugin ($config, $dn);
$this->strID = $strID;
+ $this->selected=$selected;
}
function execute()
$divlist->SetHeader(array(array("string"=>" "),
array("string"=>"Name"),
array("string"=>"Version"),
- array("string"=>"Description")));
+ array("string"=>"Description","attach"=>"style='border-right:0px;'")));
if(isset($_GET['search'])){
$this->searchStr= $_GET['search']."*";
$CHKS = "<table><tr><td><input type='hidden' value='chkchange' name='chkchange'>";
foreach($this->categories as $cat => $selected){
if($selected){
- $CHKS .="<input type='checkbox' value='1' name='CAT".$cat."' checked> ".$cat." ";
+ $CHKS .="<input type='checkbox' value='1' name='CAT".$cat."' checked onclick='document.mainform.submit()'> ".$cat." ";
}else{
- $CHKS .="<input type='checkbox' value='1' name='CAT".$cat."'> ".$cat." ";
+ $CHKS .="<input type='checkbox' value='1' name='CAT".$cat."' onclick='document.mainform.submit()'> ".$cat." ";
}
}
$CHKS .= "<br><input type='submit' name='refresh0' value='"._("refresh")."'> </td></tr></table>";
$packages = array_merge($packages,$pkgs[$cat]);
}
}
-/*
+
foreach($_POST as $name => $value){
if(preg_match("/^wasonpage_/i",$name)){
$name = preg_replace("/^wasonpage_/","",$name);
+ $n =base64_decode($name);
if(isset($_POST['use_'.$name])){
- print "was checked";
+ $this->selected[$n] = $n;
+ }else{
+ if(isset($this->selected[$n])){
+ unset($this->selected[$n]);
+ }
}
+
}
-
}
-*/
foreach($packages as $pkg){
if(preg_match("/^".str_replace("*",".*",$this->searchStr)."/i",$pkg[0])){
- $chkbox = "<input type='checkbox' value='1' name='use_".base64_encode($pkg[0])."'>
+ if(in_array($pkg[0],$this->selected)){
+ $check = " checked ";
+ }else{
+ $check = "";
+ }
+ $chkbox = "<input type='checkbox' value='1' name='use_".base64_encode($pkg[0])."' ".$check." onclick='document.mainform.submit()'>
<input type='hidden' value='1' name='wasonpage_".base64_encode($pkg[0])."'>";
$divlist->AddEntry(array(array("string"=>$chkbox),
array("string"=>$pkg[0]),
array("string"=>$pkg[1]),
- array("string"=>$pkg[3])));
+ array("string"=>$pkg[3],"attach"=>"style='border-right:0px'")));
}
}
/* Save data to object */
function save_object()
{
+ foreach($_POST as $name => $value){
+ if(preg_match("/^wasonpage_/i",$name)){
+ $name = preg_replace("/^wasonpage_/","",$name);
+ $n =base64_decode($name);
+ if(isset($_POST['use_'.$name])){
+ $this->selected[$n] = $n;
+ }else{
+ if(isset($this->selected[$n])){
+ unset($this->selected[$n]);
+ }
+ }
+
+ }
+ }
+
}
/* Check supplied data */
function save()
{
- $tmp = array();
- foreach($this->FAIAllclasses as $class => $obj){
- if($obj['status']==true){
- $tmp[$class]=$class;
+/*
+ $a_ret= array();
+ $pkgs = $this->genPkgs();
+ foreach($this->selected as $pkg){
+ foreach($pkgs as $cat => $obj){
+ foreach($obj as $package){
+ if($package[0] == $pkg){
+ $a_ret[$package[0]]=$package;
+ }
+ }
}
}
- return($tmp);
+ return($a_ret);
+*/
+
+ return($this->selected);
}
/* Generate listbox friendly SubObject list