From: hickert Date: Thu, 19 Jun 2008 08:51:54 +0000 (+0000) Subject: Updated DAK class names. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=77f58b0432569508de450a3d734a26cf5d3b2ab4;p=gosa.git Updated DAK class names. -Removed _ git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11364 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/dak/addons/dak/class_dak_keyring.inc b/gosa-plugins/dak/addons/dak/class_dak_keyring.inc deleted file mode 100644 index 89956be6a..000000000 --- a/gosa-plugins/dak/addons/dak/class_dak_keyring.inc +++ /dev/null @@ -1,273 +0,0 @@ -Servers = DAK::get_repositories_by_server($this->config); - if(count($this->Servers)){ - $this->selected_Server = key($this->Servers); - } - } - - - /*! \brief Create HTML output for this plugin. - @return String HTML output. - */ - public function execute() - { - if(isset($_POST['search'])){ - $this->refresh_list(); - } - - $smarty= get_smarty(); - $smarty->assign("Servers" , $this->Servers); - $smarty->assign("selected_Server" , $this->selected_Server); - $smarty->assign("list",$this->CreateList()); - return($smarty->fetch (get_template_path('dak_keyring.tpl', TRUE, dirname(__FILE__)))); - } - - - /*! \brief Refresh the list of keys for the currently selected server - This function is automatically called when a key was added and removed. - */ - private function refresh_list() - { - $this->list = DAK::list_keys($this->Servers[$this->selected_Server]['MAC']); - } - - - /*! \brief Creates the HTML output representing the keylist - for this currently selected server - @return String HTML list containig all keys for the selected server. - */ - private function CreateList() - { - $divlist = new divlist("DAK_keyring"); - $divlist->SetWidth("100%"); - $divlist->SetHeight("450px"); - $divlist->SetEntriesPerPage(0); - - /* Set default col styles - */ - $s0 = "style='width:10px;'"; - $s1 = "style='width:100px;'"; - $s2 = "style='width:100px;'"; - $s3 = "style='width:100px;'"; - $s4 = ""; - $s5 = "style='width:100px; border-right:0px;'"; - - /* Add header - */ - $h0 = array("string" => "", "attach" => $s0); - $h1 = array("string" => _("Key ID"), "attach" => $s1); - $h2 = array("string" => _("Length"), "attach" => $s2); - $h3 = array("string" => _("Validity"), "attach" => $s3); - $h4 = array("string" => _("UID"), "attach" => $s4); - $h5 = array("string" => _("Action"), "attach" => $s5); - $divlist->SetHeader(array($h0,$h1,$h2,$h3,$h4,$h5)); - - /* Add entries - */ - foreach($this->list as $key => $entry){ - - /* Check if all attributes are given - */ - if(!is_array($entry['UID'])){ - $entry['UID'] = array($entry['UID']); - } - $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']; - } - - /* Create detail icon - */ - $hide = " "; - $down = " "; - - $actions = ""; - - /* Add detailed entry - (All UIDs are listed, each in a single column) - */ - if(isset($entry['DETAILS']) && $entry['DETAILS'] == TRUE){ - $first = TRUE; - foreach($entry['UID'] as $val){ - - $f0 = array("string" => "","attach" => $s0); - $f1 = array("string" => "","attach" => $s1); - $f2 = array("string" => "","attach" => $s2); - $f3 = array("string" => "","attach" => $s3); - $f4 = array("string" => htmlentities($val) ,"attach" => $s4); - $f5 = array("string" => "","attach" => $s5); - - if($first){ - $first = FALSE; - $f0 = array("string" => $hide ,"attach" => $s0); - $f1 = array("string" => $key_id ,"attach" => $s1); - $f2 = array("string" => $length ,"attach" => $s2); - $f3 = array("string" => $valid ,"attach" => $s3); - $f4 = array("string" => htmlentities($val) ,"attach" => $s4); - $f5 = array("string" => $actions ,"attach" => $s5); - } - $divlist->AddEntry(array($f0,$f1,$f2,$f3,$f4,$f5)); - } - }else{ - - /* Add non detailed entries, just the first uid is displayed. - */ - if(count($entry['UID']) > 1){ - $f0 = array("string" => $down, "attach" => $s0); - }else{ - $f0 = array("string" => "", "attach" => $s0); - } - $f1 = array("string" => $key_id, "attach" => $s1); - $f2 = array("string" => $length, "attach" => $s2); - $f3 = array("string" => $valid, "attach" => $s3); - $f4 = array("string" => htmlentities($entry['UID'][0]), "attach" => $s4); - $f5 = array("string" => $actions,"attach" => $s5); - $divlist->AddEntry(array($f0,$f1,$f2,$f3,$f4,$f5)); - - } - } - return($divlist->DrawList()); - } - - - /*! \brief Act on the HTML posts for this plugin - */ - public function save_object() - { - plugin::save_object(); - - /* Save html posts, like the selected repository server - */ - foreach($this->attributes as $attr){ - if(isset($_POST[$attr])){ - $this->$attr = get_post($attr); - } - } - - /* Display details icon was clicked - */ - foreach($_POST as $name => $value){ - if(preg_match("/^remove_key_/",$name)){ - $id = preg_replace("/^remove_key_([0-9]*)_.*$/","\\1",$name); - $this->remove_key($id); - break; - } - - if(preg_match("/^details_/",$name)){ - $id = preg_replace("/^details_([0-9]*)_.*$/","\\1",$name); - if(isset($this->list[$id])){ - if(!isset($this->list[$id]['DETAILS']) || !$this->list[$id]['DETAILS']){ - $this->list[$id]['DETAILS'] = TRUE; - }else{ - $this->list[$id]['DETAILS'] = FALSE; - } - break; - } - } - } - - /* 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(); - } - } - } - } - - - /*! \brief Removes the given key from the keyring server. - @return Boolean TRUE in case of success else FALSE. - */ - private function remove_key($key) - { - if($this->list[$key]){ - $mac = $this->Servers[$this->selected_Server]['MAC']; - return(DAK::remove_key($mac,$this->list[$key]['ATTRIBUTES']['UID'])); - } - } - - - /*! \brief Imports a new key into the keyring for the currently selected server - @return Boolean TRUE in case of success else FALSE. - */ - private function import_key($key) - { - $mac = $this->Servers[$this->selected_Server]['MAC']; - return(DAK::import_key($mac,$key)); - } - - - /*! \brief ACL plugin information - */ - static function plInfo() - { - return (array( - "plShortName" => _("DAK keyring")." ("._("Addon").")", - "plDescription" => _("DAK keyring management")." ("._("Addon").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 98, - "plSection" => array("addon"), - "plCategory" => array("server"), - "plProvidedAcls" => - array( - ) - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/dak/addons/dak/class_dak_queue.inc b/gosa-plugins/dak/addons/dak/class_dak_queue.inc deleted file mode 100644 index 3b23e0bcf..000000000 --- a/gosa-plugins/dak/addons/dak/class_dak_queue.inc +++ /dev/null @@ -1,71 +0,0 @@ -assign("Repositories" , DAK::get_repositories($this->config)); - $smarty->assign("selected_Repository" , $this->selected_Repository); - return($smarty->fetch (get_template_path('dak_queue.tpl', TRUE, dirname(__FILE__)))); - } - - public function save_object() - { - plugin::save_object(); - - foreach($this->attributes as $attr){ - if(isset($_POST[$attr])){ - $this->$attr = get_post($attr); - } - } - } - - /*! \brief ACL plugin information - */ - static function plInfo() - { - return (array( - "plShortName" => _("DAK queue")." ("._("Addon").")", - "plDescription" => _("DAK queue management")." ("._("Addon").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 98, - "plSection" => array("addon"), - "plCategory" => array("server"), - "plProvidedAcls" => - array( - ) - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/dak/addons/dak/class_dak_repository.inc b/gosa-plugins/dak/addons/dak/class_dak_repository.inc deleted file mode 100644 index cad356b8f..000000000 --- a/gosa-plugins/dak/addons/dak/class_dak_repository.inc +++ /dev/null @@ -1,57 +0,0 @@ -fetch (get_template_path('dak_repository.tpl', TRUE, dirname(__FILE__)))); - } - - - - /*! \brief ACL plugin information - */ - static function plInfo() - { - return (array( - "plShortName" => _("DAK repository")." ("._("Addon").")", - "plDescription" => _("DAK repository management")." ("._("Addon").")", - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 98, - "plSection" => array("addon"), - "plCategory" => array("server"), - "plProvidedAcls" => - array( - ) - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/dak/addons/dak/class_dakkeyring.inc b/gosa-plugins/dak/addons/dak/class_dakkeyring.inc new file mode 100644 index 000000000..89956be6a --- /dev/null +++ b/gosa-plugins/dak/addons/dak/class_dakkeyring.inc @@ -0,0 +1,273 @@ +Servers = DAK::get_repositories_by_server($this->config); + if(count($this->Servers)){ + $this->selected_Server = key($this->Servers); + } + } + + + /*! \brief Create HTML output for this plugin. + @return String HTML output. + */ + public function execute() + { + if(isset($_POST['search'])){ + $this->refresh_list(); + } + + $smarty= get_smarty(); + $smarty->assign("Servers" , $this->Servers); + $smarty->assign("selected_Server" , $this->selected_Server); + $smarty->assign("list",$this->CreateList()); + return($smarty->fetch (get_template_path('dak_keyring.tpl', TRUE, dirname(__FILE__)))); + } + + + /*! \brief Refresh the list of keys for the currently selected server + This function is automatically called when a key was added and removed. + */ + private function refresh_list() + { + $this->list = DAK::list_keys($this->Servers[$this->selected_Server]['MAC']); + } + + + /*! \brief Creates the HTML output representing the keylist + for this currently selected server + @return String HTML list containig all keys for the selected server. + */ + private function CreateList() + { + $divlist = new divlist("DAK_keyring"); + $divlist->SetWidth("100%"); + $divlist->SetHeight("450px"); + $divlist->SetEntriesPerPage(0); + + /* Set default col styles + */ + $s0 = "style='width:10px;'"; + $s1 = "style='width:100px;'"; + $s2 = "style='width:100px;'"; + $s3 = "style='width:100px;'"; + $s4 = ""; + $s5 = "style='width:100px; border-right:0px;'"; + + /* Add header + */ + $h0 = array("string" => "", "attach" => $s0); + $h1 = array("string" => _("Key ID"), "attach" => $s1); + $h2 = array("string" => _("Length"), "attach" => $s2); + $h3 = array("string" => _("Validity"), "attach" => $s3); + $h4 = array("string" => _("UID"), "attach" => $s4); + $h5 = array("string" => _("Action"), "attach" => $s5); + $divlist->SetHeader(array($h0,$h1,$h2,$h3,$h4,$h5)); + + /* Add entries + */ + foreach($this->list as $key => $entry){ + + /* Check if all attributes are given + */ + if(!is_array($entry['UID'])){ + $entry['UID'] = array($entry['UID']); + } + $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']; + } + + /* Create detail icon + */ + $hide = " "; + $down = " "; + + $actions = ""; + + /* Add detailed entry + (All UIDs are listed, each in a single column) + */ + if(isset($entry['DETAILS']) && $entry['DETAILS'] == TRUE){ + $first = TRUE; + foreach($entry['UID'] as $val){ + + $f0 = array("string" => "","attach" => $s0); + $f1 = array("string" => "","attach" => $s1); + $f2 = array("string" => "","attach" => $s2); + $f3 = array("string" => "","attach" => $s3); + $f4 = array("string" => htmlentities($val) ,"attach" => $s4); + $f5 = array("string" => "","attach" => $s5); + + if($first){ + $first = FALSE; + $f0 = array("string" => $hide ,"attach" => $s0); + $f1 = array("string" => $key_id ,"attach" => $s1); + $f2 = array("string" => $length ,"attach" => $s2); + $f3 = array("string" => $valid ,"attach" => $s3); + $f4 = array("string" => htmlentities($val) ,"attach" => $s4); + $f5 = array("string" => $actions ,"attach" => $s5); + } + $divlist->AddEntry(array($f0,$f1,$f2,$f3,$f4,$f5)); + } + }else{ + + /* Add non detailed entries, just the first uid is displayed. + */ + if(count($entry['UID']) > 1){ + $f0 = array("string" => $down, "attach" => $s0); + }else{ + $f0 = array("string" => "", "attach" => $s0); + } + $f1 = array("string" => $key_id, "attach" => $s1); + $f2 = array("string" => $length, "attach" => $s2); + $f3 = array("string" => $valid, "attach" => $s3); + $f4 = array("string" => htmlentities($entry['UID'][0]), "attach" => $s4); + $f5 = array("string" => $actions,"attach" => $s5); + $divlist->AddEntry(array($f0,$f1,$f2,$f3,$f4,$f5)); + + } + } + return($divlist->DrawList()); + } + + + /*! \brief Act on the HTML posts for this plugin + */ + public function save_object() + { + plugin::save_object(); + + /* Save html posts, like the selected repository server + */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = get_post($attr); + } + } + + /* Display details icon was clicked + */ + foreach($_POST as $name => $value){ + if(preg_match("/^remove_key_/",$name)){ + $id = preg_replace("/^remove_key_([0-9]*)_.*$/","\\1",$name); + $this->remove_key($id); + break; + } + + if(preg_match("/^details_/",$name)){ + $id = preg_replace("/^details_([0-9]*)_.*$/","\\1",$name); + if(isset($this->list[$id])){ + if(!isset($this->list[$id]['DETAILS']) || !$this->list[$id]['DETAILS']){ + $this->list[$id]['DETAILS'] = TRUE; + }else{ + $this->list[$id]['DETAILS'] = FALSE; + } + break; + } + } + } + + /* 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(); + } + } + } + } + + + /*! \brief Removes the given key from the keyring server. + @return Boolean TRUE in case of success else FALSE. + */ + private function remove_key($key) + { + if($this->list[$key]){ + $mac = $this->Servers[$this->selected_Server]['MAC']; + return(DAK::remove_key($mac,$this->list[$key]['ATTRIBUTES']['UID'])); + } + } + + + /*! \brief Imports a new key into the keyring for the currently selected server + @return Boolean TRUE in case of success else FALSE. + */ + private function import_key($key) + { + $mac = $this->Servers[$this->selected_Server]['MAC']; + return(DAK::import_key($mac,$key)); + } + + + /*! \brief ACL plugin information + */ + static function plInfo() + { + return (array( + "plShortName" => _("DAK keyring")." ("._("Addon").")", + "plDescription" => _("DAK keyring management")." ("._("Addon").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 98, + "plSection" => array("addon"), + "plCategory" => array("server"), + "plProvidedAcls" => + array( + ) + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/dak/addons/dak/class_dakqueue.inc b/gosa-plugins/dak/addons/dak/class_dakqueue.inc new file mode 100644 index 000000000..3b23e0bcf --- /dev/null +++ b/gosa-plugins/dak/addons/dak/class_dakqueue.inc @@ -0,0 +1,71 @@ +assign("Repositories" , DAK::get_repositories($this->config)); + $smarty->assign("selected_Repository" , $this->selected_Repository); + return($smarty->fetch (get_template_path('dak_queue.tpl', TRUE, dirname(__FILE__)))); + } + + public function save_object() + { + plugin::save_object(); + + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = get_post($attr); + } + } + } + + /*! \brief ACL plugin information + */ + static function plInfo() + { + return (array( + "plShortName" => _("DAK queue")." ("._("Addon").")", + "plDescription" => _("DAK queue management")." ("._("Addon").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 98, + "plSection" => array("addon"), + "plCategory" => array("server"), + "plProvidedAcls" => + array( + ) + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/dak/addons/dak/class_dakrepository.inc b/gosa-plugins/dak/addons/dak/class_dakrepository.inc new file mode 100644 index 000000000..cad356b8f --- /dev/null +++ b/gosa-plugins/dak/addons/dak/class_dakrepository.inc @@ -0,0 +1,57 @@ +fetch (get_template_path('dak_repository.tpl', TRUE, dirname(__FILE__)))); + } + + + + /*! \brief ACL plugin information + */ + static function plInfo() + { + return (array( + "plShortName" => _("DAK repository")." ("._("Addon").")", + "plDescription" => _("DAK repository management")." ("._("Addon").")", + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 98, + "plSection" => array("addon"), + "plCategory" => array("server"), + "plProvidedAcls" => + array( + ) + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?>