Code

Fixed problem with not clickable buttons in fai package error msgs
[gosa.git] / plugins / admin / fai / class_faiPackageEntry.inc
index e4049b865d39893db9dd519b11bf619d0884245c..ce2b6e98a361189bb65abbb1fd434a0ac6a66684 100644 (file)
@@ -77,7 +77,12 @@ class faiPackageEntry extends plugin
       } 
     }
 
-        @ksort($this->categories);
+    $this->searchStrPKG = preg_replace("/^\+/","",$this->searchStrPKG);
+    if(empty($this->searchStrPKG)){
+      $this->searchStrPKG = "*";
+    }
+
+    @ksort($this->categories);
 
 $CHKS = "<input type='hidden' value='chkchange' name='chkchange'><table summary=''><tr>";
     $i = 0;
@@ -113,10 +118,17 @@ $CHKS = "<input type='hidden' value='chkchange' name='chkchange'><table summary=
       }
     }
 
+    /* Prepare search filter */
+    $search_str = preg_replace("/\\\\\*/",".*",normalizePreg($this->searchStrPKG));
+
     $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($cnt > 200) {
+        print_red(sprintf(_("Your specified search string '%s' returned too many results. Only the first 200 entries are shown, to keep the memory usage low."),$this->searchStrPKG));
+        break;
+      }
+      if((preg_match("/^".$search_str."/i",$pkg[0]))||
+         (preg_match("/^".$search_str."/i",$pkg[3]))){
         if($this->categories[$pkg[2]]){
           if(in_array($pkg[0],$this->selected)){
             $check = " checked ";
@@ -124,7 +136,7 @@ $CHKS = "<input type='hidden' value='chkchange' name='chkchange'><table summary=
             $check = "";
           }
           $cnt ++ ;
-          $chkbox = "<input type='checkbox' value='1' name='use_".base64_encode($pkg[0])."' ".$check." onclick='document.mainform.submit()'>
+          $chkbox = "<input type='checkbox' value='1' name='use_".base64_encode($pkg[0])."' ".$check.">
                    <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;'"),
@@ -172,7 +184,9 @@ $CHKS = "<input type='hidden' value='chkchange' name='chkchange'><table summary=
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+        
     return ($message);
   }