From 75848304b76da2ee334d93b0f08919f476243c80 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 16 Jun 2008 09:49:53 +0000 Subject: [PATCH] Updated import git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11338 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../dak/addons/dak/class_dak_keyring.inc | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/gosa-plugins/dak/addons/dak/class_dak_keyring.inc b/gosa-plugins/dak/addons/dak/class_dak_keyring.inc index 5b7c79f2d..bf20006a7 100644 --- a/gosa-plugins/dak/addons/dak/class_dak_keyring.inc +++ b/gosa-plugins/dak/addons/dak/class_dak_keyring.inc @@ -44,7 +44,7 @@ class dak_keyring extends plugin public function execute() { if(isset($_POST['search'])){ - $this->list = DAK::get_queue_entries_for_servers($this->Servers[$this->selected_Server]['MAC']); + $this->refresh_list(); } $smarty= get_smarty(); @@ -55,6 +55,11 @@ class dak_keyring extends plugin } + private function refresh_list() + { + $this->list = DAK::get_queue_entries_for_servers($this->Servers[$this->selected_Server]['MAC']); + } + private function CreateList() { /* Get ring entries for the currently selected repository @@ -85,9 +90,17 @@ class dak_keyring extends plugin if(!is_array($entry['UID'])){ $entry['UID'] = array($entry['UID']); } - $key_id = $entry['ATTRIBUTES']['UID']; - $length = $entry['ATTRIBUTES']['LENGTH']; - $valid = $entry['ATTRIBUTES']['VALID']; + $key_id = $length = $valid = ""; + + if(isset($entry['ATTRIBUTES']['UID'])){ + $key_id = $entry['ATTRIBUTES']['UID']; + } + if(isset($entry['ATTRIBUTES']['LENGTH'])){ + $length = $entry['ATTRIBUTES']['LENGTH']; + } + if(isset($entry['ATTRIBUTES']['VALID'])){ + $valid = $entry['ATTRIBUTES']['VALID']; + } $hide = " "; $down = " "; @@ -137,7 +150,7 @@ class dak_keyring extends plugin $this->$attr = get_post($attr); } } - + /* Display details icon was clicked */ foreach($_POST as $name => $value){ @@ -153,6 +166,23 @@ class dak_keyring extends plugin } } } + + /* Import new keys + */ + if(isset($_POST['import_key']) && isset($_FILES['import'])){ + if($_FILES['import']['size'] != 0){ + $key = file_get_contents($_FILES['import']['tmp_name']); + if($this->import_key($key)){ + $this->refresh_list(); + } + } + } + } + + private function import_key($key) + { + $mac = $this->Servers[$this->selected_Server]['MAC']; + return(DAK::import($mac,$key)); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -- 2.30.2