From 9f17d11534b3c0217b1403f1763d3edb4c31612f Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 28 Jan 2010 14:36:23 +0000 Subject: [PATCH] Added class selection dialog for FAIprofiles git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15424 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/classSelect/class_classSelect.inc | 62 +++++++++++++++ .../fai/classSelect/selectClass-filter.tpl | 37 +++++++++ .../fai/classSelect/selectClass-filter.xml | 60 ++++++++++++++ .../fai/classSelect/selectClass-list.tpl | 39 ++++++++++ .../fai/classSelect/selectClass-list.xml | 78 +++++++++++++++++++ .../fai/admin/fai/class_faiProfile.inc | 39 ++++------ 6 files changed, 292 insertions(+), 23 deletions(-) create mode 100644 gosa-plugins/fai/admin/fai/classSelect/class_classSelect.inc create mode 100644 gosa-plugins/fai/admin/fai/classSelect/selectClass-filter.tpl create mode 100644 gosa-plugins/fai/admin/fai/classSelect/selectClass-filter.xml create mode 100644 gosa-plugins/fai/admin/fai/classSelect/selectClass-list.tpl create mode 100644 gosa-plugins/fai/admin/fai/classSelect/selectClass-list.xml diff --git a/gosa-plugins/fai/admin/fai/classSelect/class_classSelect.inc b/gosa-plugins/fai/admin/fai/classSelect/class_classSelect.inc new file mode 100644 index 000000000..c5e8612d0 --- /dev/null +++ b/gosa-plugins/fai/admin/fai/classSelect/class_classSelect.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("selectClass-filter.xml", true, dirname(__FILE__))); + $filter->setObjectStorage($this->storagePoints); + #} + $this->setFilter($filter); + + // Build headpage + $headpage = new listing(get_template_path("selectClass-list.xml", true, dirname(__FILE__))); + $headpage->setFilter($filter); + parent::__construct($config, $ui, "object", $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/classSelect/selectClass-filter.tpl b/gosa-plugins/fai/admin/fai/classSelect/selectClass-filter.tpl new file mode 100644 index 000000000..e1016c059 --- /dev/null +++ b/gosa-plugins/fai/admin/fai/classSelect/selectClass-filter.tpl @@ -0,0 +1,37 @@ +
+

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

+
+ +
+ +
+ +{$USER} 
+{$GROUP} 
+ +
+ {$SCOPE} + + + + + + +
+ + + {$NAME} +
+ + + + + +
+ {$APPLY} +
+
diff --git a/gosa-plugins/fai/admin/fai/classSelect/selectClass-filter.xml b/gosa-plugins/fai/admin/fai/classSelect/selectClass-filter.xml new file mode 100644 index 000000000..5dc11eead --- /dev/null +++ b/gosa-plugins/fai/admin/fai/classSelect/selectClass-filter.xml @@ -0,0 +1,60 @@ + + + + + users + + true + + + + + LDAPBlacklist + (&(|$USER $GROUP ) $NAME) + dn + objectClass + cn + sn + uid + givenName + description + userPassword + + auto + + + + textfield + NAME + 20 + 60 + + + (|(cn=*$*)(sn=*$*)(givenName=*$*)) + true + + LDAPBlacklist + (&(objectClass=gosaAccount)(|(cn=*$NAME*)(sn=*$NAME*)(givenName=*$NAME*))) + cn + 0.5 + 3 + + + + + checkbox + USER + true + (&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))) + + + + + checkbox + GROUP + true + + (objectClass=posixGroup) + + + diff --git a/gosa-plugins/fai/admin/fai/classSelect/selectClass-list.tpl b/gosa-plugins/fai/admin/fai/classSelect/selectClass-list.tpl new file mode 100644 index 000000000..3043f9e8d --- /dev/null +++ b/gosa-plugins/fai/admin/fai/classSelect/selectClass-list.tpl @@ -0,0 +1,39 @@ + + + + + + + +
+
+

 {$HEADLINE} {$SIZELIMIT}

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

 

+

+ +   + +

+ + diff --git a/gosa-plugins/fai/admin/fai/classSelect/selectClass-list.xml b/gosa-plugins/fai/admin/fai/classSelect/selectClass-list.xml new file mode 100644 index 000000000..cf197a970 --- /dev/null +++ b/gosa-plugins/fai/admin/fai/classSelect/selectClass-list.xml @@ -0,0 +1,78 @@ + + + + + false + false + false + false + + users + + 1 + + + + gosaAccount + users + user + plugins/users/images/select_user.png + + + + + posixGroup + groups + group + plugins/groups/images/groups.png + + + + + + |20px;c|220px|| + + + %{filter:objectType(dn,objectClass)} + + + + %{filter:departmentLink(row,dn,description)} + 1 + + + + %{filter:objectType(dn,objectClass)} + + + + + cn + string + %{cn} + true + + + + + description + string + %{description} + true + + +
+ + + + + + + edit + entry + gosaAccount + images/lists/edit.png + + + +
diff --git a/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/gosa-plugins/fai/admin/fai/class_faiProfile.inc index 018d8c750..67d41d187 100644 --- a/gosa-plugins/fai/admin/fai/class_faiProfile.inc +++ b/gosa-plugins/fai/admin/fai/class_faiProfile.inc @@ -23,6 +23,8 @@ class faiProfile extends plugin var $FAIstate = ""; var $view_logged = FALSE; + var $classSelect; + function faiProfile(&$config, $dn= NULL) { /* Load Attributes */ @@ -250,39 +252,30 @@ class faiProfile extends plugin } if($s_action == "add" && $this->acl_is_writeable("FAIclass")){ - $this->dialog = new faiProfileEntry($this->config,$this->dn,$this->FAIclasses,$this->parent->parent->fai_release); - $this->is_dialog =true; + $this->classSelect = new classSelect($this->config, get_userinfo()); + $this->dialog =true; } /* Save Dialog */ - if(isset($_POST['SaveSubObject'])){ - $this->dialog->save_object(); - $msgs= $this->dialog->check(); - if(count($msgs)){ - msg_dialog::display(_("Error"), $msgs, ERROR_DIALOG); - }else{ - $ret = $this->dialog->save(); - foreach($ret as $class){ - $this->FAIclasses[$class] =$class; - } - $this->is_dialog=false; - unset($this->dialog); - $this->dialog=FALSE; - //ksort($this->FAIclasses); + if(isset($_POST['classSelect_save'])){ + $list = $this->classSelect->save(); + foreach($list as $entry){ + $class = $entry['cn'][0]; + $this->FAIclasses[$class] =$class; } + $this->dialog=false; + $this->classSelect=FALSE; } } /* Cancel Dialog */ - if(isset($_POST['CancelSubObject'])){ - $this->is_dialog=false; - unset($this->dialog); - $this->dialog=FALSE; + if(isset($_POST['classSelect_cancel']) && $this->classSelect instanceOf classSelect){ + $this->dialog=false; + $this->classSelect=FALSE; } - if(is_object($this->dialog)){ - $this->dialog->save_object(); - return($this->dialog->execute()); + if($this->classSelect instanceOf classSelect){ + return($this->classSelect->execute()); } $divlist =new divSelectBox("Profile"); -- 2.30.2