From 49b341ace9d56213c04d06b4295236723d33616b Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 28 Jan 2010 14:12:07 +0000 Subject: [PATCH] Added Package selection dialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15422 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../packageSelect/class_filterFAIPackages.inc | 69 +++++++++++++++++++ .../fai/packageSelect/class_packageSelect.inc | 62 +++++++++++++++++ .../packageSelect/selectPackage-filter.tpl | 34 +++++++++ .../packageSelect/selectPackage-filter.xml | 39 +++++++++++ .../fai/packageSelect/selectPackage-list.tpl | 37 ++++++++++ .../fai/packageSelect/selectPackage-list.xml | 64 +++++++++++++++++ 6 files changed, 305 insertions(+) create mode 100644 gosa-plugins/fai/admin/fai/packageSelect/class_filterFAIPackages.inc create mode 100644 gosa-plugins/fai/admin/fai/packageSelect/class_packageSelect.inc create mode 100644 gosa-plugins/fai/admin/fai/packageSelect/selectPackage-filter.tpl create mode 100644 gosa-plugins/fai/admin/fai/packageSelect/selectPackage-filter.xml create mode 100644 gosa-plugins/fai/admin/fai/packageSelect/selectPackage-list.tpl create mode 100644 gosa-plugins/fai/admin/fai/packageSelect/selectPackage-list.xml diff --git a/gosa-plugins/fai/admin/fai/packageSelect/class_filterFAIPackages.inc b/gosa-plugins/fai/admin/fai/packageSelect/class_filterFAIPackages.inc new file mode 100644 index 000000000..2b718f9ba --- /dev/null +++ b/gosa-plugins/fai/admin/fai/packageSelect/class_filterFAIPackages.inc @@ -0,0 +1,69 @@ +FAI_get_packages($release,$attrs,$filter,0,200); + if($q->is_error()){ + msg_dialog::display(_("Service infrastructure"),msgPool::siError($q->get_error()),ERROR_DIALOG); + }else{ + foreach($ret as $attr){ + + $attr['objectClass'] = "FAKE_OC__FaiPackage"; + $attr['DESCRIPTION'] = base64_decode($attr['DESCRIPTION']); + + $item = array(); + $item['dn'] = "dn=".$attr['PACKAGE'].",".$attr['DISTRIBUTION'].",".$base; + $item['count']= 0; + foreach($attr as $key => $value){ + $item['count']++; + $item[] = $key; + $item[$key] = array('count' => 1, $value); + } + $pkgs[] = $item; + } + } + + return(filterLDAPBlacklist::filterByBlacklist($pkgs)); + } + + static function filterByBlacklist($entries) + { + if(session::is_set('filterBlacklist')){ + $blist = session::get('filterBlacklist'); + foreach($blist as $attr_name => $attr_values){ + foreach($attr_values as $match){ + foreach($entries as $id => $entry){ + if(isset($entry[$attr_name])){ + $test = $entry[$attr_name]; + if(!is_array($test)) $test = array($test); + if(in_array($match, $test)) unset($entries[$id]); + } + } + } + } + } + return(array_values($entries)); + } + + function save() + { + $act = $this->detectPostActions(); + $headpage = $this->getHeadpage(); + if(!isset($act['targets'])) return(array()); + $ret = array(); + foreach($act['targets'] as $dn){ + $ret[] = $headpage->getEntry($dn); + } + return($ret); + } + +} + +?> diff --git a/gosa-plugins/fai/admin/fai/packageSelect/class_packageSelect.inc b/gosa-plugins/fai/admin/fai/packageSelect/class_packageSelect.inc new file mode 100644 index 000000000..fba6e8b9e --- /dev/null +++ b/gosa-plugins/fai/admin/fai/packageSelect/class_packageSelect.inc @@ -0,0 +1,62 @@ +config = $config; + $this->ui = $ui; + +# // Build filter +# if (session::global_is_set(get_class($this)."_filter")){ +# $filter= session::global_get(get_class($this)."_filter"); +# } else { + $filter = new filter(get_template_path("selectPackage-filter.xml", true, dirname(__FILE__))); +# } + $this->setFilter($filter); + + // Build headpage + $headpage = new listing(get_template_path("selectPackage-list.xml", true, dirname(__FILE__))); + $headpage->setFilter($filter); + parent::__construct($config, $ui, "FAI-packages", $headpage); + } + + function save() + { + $act = $this->detectPostActions(); + $headpage = $this->getHeadpage(); + if(!isset($act['targets'])) return(array()); + $ret = array(); + foreach($act['targets'] as $dn){ + $ret[] = $headpage->getEntry($dn); + } + return($ret); + } + +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-filter.tpl b/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-filter.tpl new file mode 100644 index 000000000..2da0e67a9 --- /dev/null +++ b/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-filter.tpl @@ -0,0 +1,34 @@ +
+

+ [F]{t}Filter{/t} +

+
+ +
+ +
+ +
+ {t}A maximum of 200 entries will be shown here.{/t} +
+ + + + + +
+ + + {$NAME} +
+ + + + + +
+ {$APPLY} +
+
diff --git a/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-filter.xml b/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-filter.xml new file mode 100644 index 000000000..febabf285 --- /dev/null +++ b/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-filter.xml @@ -0,0 +1,39 @@ + + + + + groups + + true + + + + + FAIPackages + $NAME + SECTION + VERSION + PACKAGE + + auto + + + + textfield + NAME + 20 + 60 + + + *$ + true + + FAIPackages + $NAME + PACKAGE + 0.5 + 3 + + + + diff --git a/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-list.tpl b/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-list.tpl new file mode 100644 index 000000000..344a065a0 --- /dev/null +++ b/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-list.tpl @@ -0,0 +1,37 @@ + + + + + + + +
+
+

 {$HEADLINE} {$SIZELIMIT}

+
+ +
+
+ + +
{$ROOT} {$BACK} {$HOME} {$RELOAD} {$SEPARATOR} {t}Base{/t} {$BASE}  {$SEPARATOR}  {$ACTIONS}
+
+
+ +
+
+ + + + {$LIST} +
+ {$FILTER} +
+ +

+ +   + +

+ + diff --git a/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-list.xml b/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-list.xml new file mode 100644 index 000000000..d1b73bdcf --- /dev/null +++ b/gosa-plugins/fai/admin/fai/packageSelect/selectPackage-list.xml @@ -0,0 +1,64 @@ + + + + + false + false + false + true + + + 1 + + + + FAKE_OC__FaiPackage + faiPackage + faiPackage + plugins/fai/images/fai_packages.png + + + + + + |20px;c||180| + + + %{filter:objectType(dn,objectClass)} + + + + %{filter:departmentLink(row,dn,description)} + 1 + + + + %{filter:objectType(dn,objectClass)} + + + + + PACKAGE + string + %{PACKAGE} + true + + + + + VERSION + string + %{VERSION} + true + + + +
+ + + + + + + +
-- 2.30.2