diff --git a/plugins/admin/fai/class_faiPackageEntry.inc b/plugins/admin/fai/class_faiPackageEntry.inc
index dbfd58951c5cecfd32c843729a9972d91b2ce6f5..57e96f97dafe4cd072eabaf6649f7fd560d30ae4 100644 (file)
var $ignore_account= TRUE;
var $attributes = array();
var $objectclasses= array();
- var $strID = "";
+ var $pkgs = array();
var $buffer = array();
var $categories = array();
- var $searchStrPKG = "Please enter your search string here";
+ var $searchStrPKG = "";
var $selected = array();
/* Array with available class names */
var $FAIAllclasses = array();
- function faiPackageEntry ($config, $dn= NULL,$strID=false,$selected=array())
+ function faiPackageEntry ($config, $dn= NULL,$pkgs,$selected=array())
{
plugin::plugin ($config, $dn);
- $this->strID = $strID;
+
+ $this->pkgs=$pkgs;
+ if(isset($_SESSION['searchStrPKG'])){
+ $this->searchStrPKG=$_SESSION['searchStrPKG'];
+ }
$this->selected=$selected;
+
+ $this->searchStrPKG= _("Please enter your search string here");
}
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
/* Fill templating stuff */
$smarty = get_smarty();
$display = "";
$divlist = new divlist("PackageEntry");
$divlist->SetSummary(_("This list displays all assigned package names for this repository settings."));
$divlist->SetEntriesPerPage(20);
- $divlist->SetHeader(array(array("string"=>" "),
- array("string"=>"Name"),
- array("string"=>"Version"),
- array("string"=>"Description","attach"=>"style='border-right:0px;'")));
+ $divlist->SetHeight("650px;");
+ $divlist->SetHeader(array(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"),
+ array("string" => "Name", "attach" => "style='width:180px;'"),
+ array("string" => "Version", "attach" ),
+ array("string" => "Description", "attach" => "style='width:240px;border-right:0px;text-align:left;'")));
if(isset($_GET['search'])){
$this->searchStrPKG= $_GET['search']."*";
}
-
- $pkgs = $this->genPkgs();
- foreach($pkgs as $cat => $entries){
- if(!isset($this->categories[$cat])){
- $this->categories[$cat] = true;
- }
- if(isset($_POST['chkchange'])){
- $this->searchStrPKG = $_POST['searchStrPKG'];
- if(isset($_POST['CAT'.$cat])){
- $this->categories[$cat]=true;
- }else{
- $this->categories[$cat]=false;
+
+ $pkgs= $this->pkgs;
+
+ unset($this->categories);
+ foreach($pkgs as $name => $entry){
+ $cat = $entry[2];
+ if(!empty($cat)){
+ if(!isset($this->categories[$cat])){
+ $this->categories[$cat] = true;
+ }
+ if(isset($_POST['chkchange'])){
+ $this->searchStrPKG = $_POST['searchStrPKG'];
+ if(isset($_POST['CAT'.$cat])){
+ $this->categories[$cat]=true;
+ }else{
+ $this->categories[$cat]=false;
+ }
}
}
-
}
+ ksort($this->categories);
+
$CHKS = "<table><tr><input type='hidden' value='chkchange' name='chkchange'>";
$i = 0;
foreach($this->categories as $cat => $selected){
}
$CHKS .= "</td></tr></table>";
- $packages = array();
- foreach($this->categories as $cat => $use){
- if($use){
- $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])){
$this->selected[$n] = $n;
}else{
}
}
- foreach($packages as $pkg){
- if(preg_match("/^".str_replace("*",".*",$this->searchStrPKG)."/i",$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]),
+ $cnt = 0;
+ foreach($pkgs as $pkg){
+ if((preg_match("/^".str_replace("*",".*",$this->searchStrPKG)."/i",$pkg[0]))||
+ (preg_match("/^".str_replace("*",".*",$this->searchStrPKG)."/i",$pkg[3]))){
+ if($this->categories[$pkg[2]]){
+ if(in_array($pkg[0],$this->selected)){
+ $check = " checked ";
+ }else{
+ $check = "";
+ }
+ $cnt ++ ;
+ $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, "attach" => "style='text-align:center;width:20px;'"),
+ array("string"=>$pkg[0], "attach" => "style='width:180px;'"),
array("string"=>$pkg[1]),
- array("string"=>$pkg[3],"attach"=>"style='border-right:0px'")));
+ array("string"=>$pkg[3], "attach" => "style='width:221px;border-right:0px;text-align:left;'")));
+ }
}
}
+ $_SESSION['searchStrPKG'] = $this->searchStrPKG;
$smarty->assign("CHKS" , $CHKS);
$smarty->assign("searchStrPKG" , $this->searchStrPKG);
$smarty->assign("faihead" , "");
function save()
{
-/*
- $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($a_ret);
-*/
-
- return($this->selected);
+ return($this->selected);
}
-
- /* Generate listbox friendly SubObject list
- */
- function genPkgs(){
- /* Generate a list off available packages for this mirror, section and release
- */
- $strID = $this->strID; // This var contains the path to the parsed package file
-
- /* Open the packelist */
- $fp = fopen($strID,"r");
- $a_ret = array();
- /* Only read this file if it wasn't read before */
- if(!isset($this->buffer[$strID])){
- $str = "";
- /* Parse every line and create an array */
- while(!feof($fp)){
- $str= fgets($fp,512);
- $stra= split("\|",$str);
- if(count($stra)==4){
- $a_ret[$stra[2]][] = $stra;
- }
- }
-
- /* Save our Data, to avoid reading it again */
- $this->buffer[$strID]=$a_ret;
- return($a_ret);
- }else{
- return $this->buffer[$strID];
- }
- }
-
-
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>