From 35c534e36c8353def7362dbe03eb7c32caf2e356 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 10 Jun 2008 08:34:59 +0000 Subject: [PATCH] Updated krb class git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11273 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/kerberos/class_krb_host_keys.inc | 84 ++++++++++++------- .../services/kerberos/krb_host_keys.tpl | 30 ++----- 2 files changed, 60 insertions(+), 54 deletions(-) diff --git a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_krb_host_keys.inc b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_krb_host_keys.inc index b1018e648..46c8150f5 100644 --- a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_krb_host_keys.inc +++ b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/class_krb_host_keys.inc @@ -215,30 +215,32 @@ class krb_host_keys extends plugin } } + /* Create a divlist to list all key settings. + */ + $divlist = new divSelectBox("Kerberos_Host/Service_Keys"); + $divlist->SetHeight(100); + $princ_id = 0; // Used in posts + $this->last_list[$prefix] = array(); - $smarty = get_smarty(); - $smarty->assign("keys" ,$this->build_html($prefix,$service_plugin)); - $smarty->assign("server_list" ,$this->server_list); - $smarty->assign("service_plugin" ,$service_plugin); - $smarty->assign("is_service_key" , $this->is_service_key); - return($smarty->fetch (get_template_path('krb_host_keys.tpl', TRUE,dirname(__FILE__)))); - } - + /* Create actions */ + $new = " +  +  "; + $rec =" +  + + "; - /*! \brief Build up an array which is used to create the - HTML content for this plugin in the smarty template. - */ - function build_html($prefix,$service_plugin) - { - $ret = array(); - - $princ_id = 0; // Used in posts - $ret = array(); foreach($this->server_list as $mac => $server){ + + /* Recreate/Remove actions */ $realm = $server['REALM']; - /* Check if the given prefix is configured for every realm + /* Check if the given prefix is configured for a realm If it is configured display the recreate and remove button if not display the create button. */ @@ -257,14 +259,23 @@ class krb_host_keys extends plugin /* Display buttons to "create" or to "remove/recreate" wheteher the prefix esists or not */ $princ_id ++; + $this->last_list[$prefix][$princ_id]['REALM'] = $realm; + $this->last_list[$prefix][$princ_id]['MAC'] = $mac; + $this->last_list[$prefix][$princ_id]['NAME'] = $master_princ; + + $field1 = array('string' => $realm ); + $field2 = array('string' => $master_princ); if($found){ - $ret[$princ_id]['USED'] = TRUE; + $field3 = array('string' => _("installed")); + $field4 = array('string' => preg_replace("/%ID%/",$princ_id,$rec),"attach" => "style='border:0px;'"); + $this->last_list[$prefix][$princ_id]['USED'] = TRUE; }else{ - $ret[$princ_id]['USED'] = FALSE; + $field3 = array('string' => "-"); + $field4 = array('string' => preg_replace("/%ID%/",$princ_id,$new),"attach" => "style='border:0px;'"); + $this->last_list[$prefix][$princ_id]['USED'] = FALSE; } - $ret[$princ_id]['REALM'] = $realm; - $ret[$princ_id]['MAC'] = $mac; - $ret[$princ_id]['NAME'] = $master_princ; + + $divlist->AddEntry(array($field1,$field2,$field3,$field4)); /* Get all additionally configured service host keys, this are all keys that do not match the master_princ. @@ -273,17 +284,32 @@ class krb_host_keys extends plugin foreach($server['PRINCIPALS'] as $id => $princ){ if(preg_match("/".normalizePreg("/".$this->namingAttr."@")."/i",$princ) && !preg_match("/^".normalizePreg($prefix)."/",$princ)){ + + /* Display buttons to "create" or to "remove/recreate" wheteher the prefix esists or not + */ $princ_id ++; - $ret[$princ_id]['USED'] = TRUE; - $ret[$princ_id]['REALM'] = $realm; - $ret[$princ_id]['MAC'] = $mac; - $ret[$princ_id]['NAME'] = $princ; + + $this->last_list[$prefix][$princ_id]['USED'] = TRUE; + $this->last_list[$prefix][$princ_id]['REALM'] = $realm; + $this->last_list[$prefix][$princ_id]['MAC'] = $mac; + $this->last_list[$prefix][$princ_id]['NAME'] = $princ; + + $field1 = array('string' => $realm ); + $field2 = array('string' => $princ); + $field3 = array('string' => _("installed")); + $field4 = array('string' => preg_replace("/%ID%/",$princ_id,$rec),"attach" => "style='border:0px;'"); + $divlist->AddEntry(array($field1,$field2,$field3,$field4)); } } } } - $this->last_list[$prefix] = $ret; - return($ret); + + $smarty = get_smarty(); + $smarty->assign("list",$divlist->DrawList()); + $smarty->assign("server_list" ,$this->server_list); + $smarty->assign("service_plugin" ,$service_plugin); + $smarty->assign("is_service_key" , $this->is_service_key); + return($smarty->fetch (get_template_path('krb_host_keys.tpl', TRUE,dirname(__FILE__)))); } diff --git a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/krb_host_keys.tpl b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/krb_host_keys.tpl index 26b5717d7..8fd276227 100644 --- a/gosa-plugins/mit-krb5/admin/systems/services/kerberos/krb_host_keys.tpl +++ b/gosa-plugins/mit-krb5/admin/systems/services/kerberos/krb_host_keys.tpl @@ -2,32 +2,12 @@

 

{/if}

{t}Kerberos keys{/t}

- -{foreach from=$keys key=ID item=data} - - - - - -{/foreach} -
{$data.REALM}{$data.NAME} - {if $data.USED} - - - - {else} - - - - {/if} -
+
+{$list} +
{if $service_plugin}

 

{/if} + + -- 2.30.2