From 5cebc29126322f21b97b18e5ca0f03e818deac5b Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 13 Apr 2010 06:35:24 +0000 Subject: [PATCH] removed old style list git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17597 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/kerberos/class_goKrbServer.inc | 79 +++++++++---------- .../systems/services/kerberos/goKrbServer.tpl | 2 +- 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_goKrbServer.inc b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_goKrbServer.inc index 31ca651ed..374effb08 100644 --- a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_goKrbServer.inc +++ b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_goKrbServer.inc @@ -79,6 +79,18 @@ class goKrbServer extends goService{ } } } + + // Prepare lists + $this->principleList = new sortableListing(); + $this->principleList->setDeleteable(true); + $this->principleList->setInstantDelete(false); + $this->principleList->setEditable(true); + $this->principleList->setWidth("100%"); + $this->principleList->setHeight("100px"); + $this->principleList->setHeader(array(_("Name"))); + $this->principleList->setColspecs(array('*','40px')); + $this->principleList->setDefaultSortColumn(0); + } @@ -138,21 +150,16 @@ class goKrbServer extends goService{ $smarty->assign($attr,$this->$attr); } - $divlist = new divSelectBox("Kerberos Policies"); - $action = image('images/lists/edit.png','policy_edit_%id'); - $action .= image('images/lists/trash.png','policy_del_%id'); + $this->principleList->setAcl($this->getAcl('goKrbPolicy')); + $data = $lData = array(); foreach($this->policies as $key => $policy){ if($policy['STATUS'] == "REMOVED") continue; - - $actions = preg_replace("/%id/",$key,$action); - $field1 = array("string" => $policy['NAME']); - $field3 = array("string" => $actions, - "attach"=>"style='width:40px; text-align:right; border:0px;'"); - - $divlist->AddEntry(array($field1,$field3)); + $data[$key] = $policy; + $lData[$key]= array('data' => array($policy['NAME'])); } - - $smarty->assign("divlist",$divlist->DrawList()); + $this->principleList->setListData($data,$lData); + $this->principleList->update(); + $smarty->assign("list",$this->principleList->render()); return($smarty->fetch(get_template_path("goKrbServer.tpl",TRUE,dirname(__FILE__)))); } @@ -257,7 +264,8 @@ class goKrbServer extends goService{ public function RemovePolicy($id) { /* Load policy information, if not done before - */ + */ + if(!isset($this->policies[$id])) return; if($this->policies[$id]['STATUS'] == "LOADED" && empty($this->policies[$id]['DATA'])){ $o = new gosaSupportDaemon(); $this->policies[$id]['DATA'] = $o->krb5_get_policy($this->macAddress,$this->policies[$id]['NAME']); @@ -288,39 +296,28 @@ class goKrbServer extends goService{ $this->id = -1; } - /* Walk through POSTs an check for image-button posts - */ - foreach($_POST as $name => $value){ - - /* Remove policy requested - */ - if(preg_match("/^policy_del/",$name)){ - $id = preg_replace("/^policy_del_([0-9]*)/i","\\1",$name); - if(isset($this->policies[$id])){ - $this->RemovePolicy($id); - } - break; - } - /* Edit Policy requested - */ - if(preg_match("/^policy_edit/",$name)){ - $id = preg_replace("/^policy_edit_([0-9]*)/i","\\1",$name); + $this->principleList->save_object(); + $action = $this->principleList->getAction(); + if($action['action'] == 'delete'){ + $id = $this->principleList->getKey($action['targets'][0]); + $this->RemovePolicy($id); + } + if($action['action'] == 'edit'){ + $id = $this->principleList->getKey($action['targets'][0]); if(isset($this->policies[$id])){ - /* Load policy information, if not done before - */ - if($this->policies[$id]['STATUS'] == "LOADED" && empty($this->policies[$id]['DATA'])){ - $o = new gosaSupportDaemon(); - $this->policies[$id]['DATA'] = $o->krb5_get_policy($this->macAddress,$this->policies[$id]['NAME']); - } + /* Load policy information, if not done before + */ + if($this->policies[$id]['STATUS'] == "LOADED" && empty($this->policies[$id]['DATA'])){ + $o = new gosaSupportDaemon(); + $this->policies[$id]['DATA'] = $o->krb5_get_policy($this->macAddress,$this->policies[$id]['NAME']); + } - /* Open dialog */ - $this->id = $id; - $this->dialog = new krb5_policy($this->config,$this->policies[$id], $this); + /* Open dialog */ + $this->id = $id; + $this->dialog = new krb5_policy($this->config,$this->policies[$id], $this); } - break; - } } } } diff --git a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/goKrbServer.tpl b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/goKrbServer.tpl index 34c6a589b..4160284c3 100644 --- a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/goKrbServer.tpl +++ b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/goKrbServer.tpl @@ -8,7 +8,7 @@ {if $MIT_KRB}

{t}Policies{/t}

{render acl=$goKrbPolicyACL} - {$divlist} + {$list} {/render} {/if} -- 2.30.2