summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c796562)
raw | patch | inline | side by side (parent: c796562)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Apr 2011 08:38:35 +0000 (08:38 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Apr 2011 08:38:35 +0000 (08:38 +0000) |
- Add support to FAI_get_packages function to filter by section,
by adding a new attribute exclude_sections which allows the
specification of an array with sections as keys (and arbitrary
values).
(This way its possible to create the array with array_filter and the
existing package_sections array in class_faiPackageEntry)
- Extend class_faiPackageEntry to hand the list of unselected sections
to FAI_get_packages
- Extend class_faiPackageEntry to keep the state of the section
selection on page reload
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@20706 594d385d-05f5-0310-b6e9-bd551577e9d8
by adding a new attribute exclude_sections which allows the
specification of an array with sections as keys (and arbitrary
values).
(This way its possible to create the array with array_filter and the
existing package_sections array in class_faiPackageEntry)
- Extend class_faiPackageEntry to hand the list of unselected sections
to FAI_get_packages
- Extend class_faiPackageEntry to keep the state of the section
selection on page reload
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@20706 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-core/include/class_gosaSupportDaemon.inc | patch | blob | history | |
trunk/gosa-plugins/fai/admin/fai/class_faiPackageEntry.inc | patch | blob | history |
diff --git a/trunk/gosa-core/include/class_gosaSupportDaemon.inc b/trunk/gosa-core/include/class_gosaSupportDaemon.inc
index af297df05da0b8655b465b1e022912d05f46f949..e887252354804d877b9db9c3db12564feb2f2715 100644 (file)
}
- public function FAI_get_packages($release,$attrs,$package,$from=-1,$to=-1)
+ public function FAI_get_packages($release,$attrs,$package,$from=-1,$to=-1, $exclude_sections=array())
{
$ret = array();
/* If no package is given, search for all */
if(!count($package)) $package = array("%");
+ /* If no section is given, search for all */
+ $section_filter = "";
+ if(count($exclude_sections)) {
+ $section_filter = '<clause><connector>AND</connector>';
+ foreach ($exclude_sections as $section => $value) {
+ $section_filter .= "<phrase><operator>ne</operator><section>"
+ .$section
+ ."</section></phrase>";
+ }
+ $section_filter .= "</clause>";
+ }
+
/* Create limit tag */
if($from == -1){
$limit ="";
<clause><connector>OR</connector>
".$pkgs."
</clause>
+ ".$section_filter."
</where>".
$limit.
"</xml>";
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiPackageEntry.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiPackageEntry.inc
index f86f89a96aff64eefcd72d3697101ef4e5c5789e..0ee58e8ebf1069dec7554586aa5272b5b68133aa 100644 (file)
<input type='hidden' value='chkchange' name='chkchange'><table summary=''><tr>";
$i = 0;
foreach($this->package_sections as $cat => $selected){
+ $Section_boxes .= "<input type='hidden' value=1 name='CAT$cat'>";
+
if($i == 2){
$Section_boxes .="</tr><tr>";
$i = 0;
}
if($selected){
- $Section_boxes .="<td><input type='checkbox' value='1' name='CAT".$cat."' checked ".
+ $Section_boxes .="<td><input type='checkbox' value='1' name='useCAT".$cat."' checked ".
"onclick='document.mainform.submit()'> ".$cat." </td>";
}else{
- $Section_boxes .="<td><input type='checkbox' value='1' name='CAT".$cat."' ".
+ $Section_boxes .="<td><input type='checkbox' value='1' name='useCAT".$cat."' ".
"onclick='document.mainform.submit()'> ".$cat." </td>";
}
$i ++ ;
+
}
$Section_boxes .= "</tr></table></div>";
array("string"=>htmlentities($desc),
"attach" => "style='border-right:0px;text-align:left;'")));
}
-
$smarty->assign("Section_boxes" , $Section_boxes);
$smarty->assign("searchStrPKG" , $this->searchStrPKG);
$smarty->assign("faihead" , "");
}
}
+ if(preg_match("/^CAT/i", $name)) {
+ $key = "use$name";
+ $section = preg_replace("/^CAT/i", "", $name);
+ if (isset($_POST[$key])) {
+ $this->package_sections[$section] = TRUE;
+ }else {
+ $this->package_sections[$section] = FALSE;
+ }
+ }
}
/* Get Posted search filter
$this->pkgs = array();
$q = new gosaSupportDaemon();
$filter = preg_replace("/\*/","%",array($this->searchStrPKG));
+
+ /* Determine filter sections */
+ $cb = create_function('$a', 'return $a != TRUE;');
+ $exclude_sections = array_filter($this->package_sections, $cb);
+
$attrs = array("distribution", "package","version", "section", "description", "timestamp");
- $ret = $q->FAI_get_packages($this->FAIdebianRelease,$attrs,$filter,0,200);
+ $ret = $q->FAI_get_packages($this->FAIdebianRelease,$attrs,$filter,0,200, $exclude_sections);
if($q->is_error()){
msg_dialog::display(_("Service infrastructure"),msgPool::siError($q->get_error()),ERROR_DIALOG);
}else{