summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cfd2107)
raw | patch | inline | side by side (parent: cfd2107)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 Jun 2008 07:33:29 +0000 (07:33 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 Jun 2008 07:33:29 +0000 (07:33 +0000) |
- Added templates.
- Added some keyring functionality. Add/REmove keys.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11361 594d385d-05f5-0310-b6e9-bd551577e9d8
- Added some keyring functionality. Add/REmove keys.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11361 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/dak/addons/dak/class_DAK.inc | [new file with mode: 0644] | patch | blob |
gosa-plugins/dak/addons/dak/class_dak_keyring.inc | patch | blob | history | |
gosa-plugins/dak/addons/dak/class_dak_queue.inc | patch | blob | history | |
gosa-plugins/dak/addons/dak/dak_keyring.tpl | [new file with mode: 0644] | patch | blob |
gosa-plugins/dak/addons/dak/dak_queue.tpl | [new file with mode: 0644] | patch | blob |
diff --git a/gosa-plugins/dak/addons/dak/class_DAK.inc b/gosa-plugins/dak/addons/dak/class_DAK.inc
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+
+
+class DAK
+{
+ public static function get_repositories($config)
+ {
+ if(!$config instanceOf config){
+ trigger_error("Invalid config object given, aborting.");
+ return;
+ }
+ $res = array();
+ $ldap = $config->get_ldap_link();
+ $ldap->cd($config->current['BASE']);
+ $ldap->search("(&(macAddress=*)(FAIrepository=*)(objectClass=FAIrepositoryServer))",array("cn","FAIrepository","macAddress"));
+ while($attrs = $ldap->fetch()){
+ for($i = 0 ; $i < $attrs['FAIrepository']['count'] ; $i ++){
+ list($url,$parent,$release,$sections) = explode("|",$attrs['FAIrepository'][$i]);
+ $repo['SECTIONS'] = split(",",$sections);
+ $repo['SERVER'] = $attrs['cn'][0];
+ $repo['RELEASE'] = $release;
+ $repo['MAC'] = $attrs['macAddress'][0];
+ $repo['PARENT'] = $parent;
+ $repo['URL'] = $url;
+ $repo['DN'] = $attrs['dn'];
+ $res[] = $repo;
+ }
+ }
+ return($res);
+ }
+
+
+ public static function get_repositories_by_server($config)
+ {
+ if(!$config instanceOf config){
+ trigger_error("Invalid config object given, aborting.");
+ return;
+ }
+ $res = array();
+ $ldap = $config->get_ldap_link();
+ $ldap->cd($config->current['BASE']);
+ $ldap->search("(&(macAddress=*)(FAIrepository=*)(objectClass=FAIrepositoryServer))",array("cn","FAIrepository","macAddress"));
+ while($attrs = $ldap->fetch()){
+ $serv = array();
+ $serv['REPOSITORIES'] = array();
+ for($i = 0 ; $i < $attrs['FAIrepository']['count'] ; $i ++){
+ list($url,$parent,$release,$sections) = explode("|",$attrs['FAIrepository'][$i]);
+ $repo['SECTIONS'] = split(",",$sections);
+ $repo['RELEASE'] = $release;
+ $repo['PARENT'] = $parent;
+ $repo['URL'] = $url;
+ $serv['REPOSITORIES'] [] = $repo;
+ }
+ $serv['MAC'] = $attrs['macAddress'][0];
+ $serv['DN'] = $attrs['dn'];
+ $serv['SERVER'] = $attrs['cn'][0];
+ $res[] = $serv;
+ }
+ return($res);
+ }
+
+
+ /*! \brief Returns all */
+ public static function list_keys($server)
+ {
+ $o_queue = new gosaSupportDaemon();
+ $data = $o_queue->DAK_get_queue_entries($server);
+ if($o_queue->is_error()){
+ msg_dialog::display(_("Error"), $o_queue->get_error(), ERROR_DIALOG);
+ }
+ return($data);
+ }
+
+
+ /*! \brief Imports the given key into a keyring specified by server
+ @param String The mac address of the server that provides the keyring.
+ @param String The Key to import.
+ @return Boolean TRUE in case of success else FALSE.
+ */
+ public static function import_key($server,$key)
+ {
+ $o_queue = new gosaSupportDaemon();
+ $o_queue->DAK_import_key($server,$key);
+ if($o_queue->is_error()){
+ msg_dialog::display(_("Error"), $o_queue->get_error(), ERROR_DIALOG);
+ return(FALSE);
+ }
+ return(TRUE);
+ }
+
+
+ /*! \brief Removes the given key from a keyring.
+ @param String The servers mac address where the keyring is located.
+ @param String The Key UID to remove.
+ @return Boolean TRUE in case of success else FALSE.
+ */
+ public static function remove_key($server,$key)
+ {
+ $o_queue = new gosaSupportDaemon();
+ $o_queue->DAK_remove_key($server,$key);
+ if($o_queue->is_error()){
+ msg_dialog::display(_("Error"), $o_queue->get_error(), ERROR_DIALOG);
+ return(FALSE);
+ }
+ return(TRUE);
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/dak/addons/dak/class_dak_keyring.inc b/gosa-plugins/dak/addons/dak/class_dak_keyring.inc
index 40285ec557c478cf47b6bcc0adbba696b0cd7839..b400a5f26911eb66076b013397f364e83687264e 100644 (file)
private function refresh_list()
{
- $this->list = DAK::get_queue_entries_for_servers($this->Servers[$this->selected_Server]['MAC']);
+ $this->list = DAK::list_keys($this->Servers[$this->selected_Server]['MAC']);
}
private function CreateList()
diff --git a/gosa-plugins/dak/addons/dak/class_dak_queue.inc b/gosa-plugins/dak/addons/dak/class_dak_queue.inc
index bab1007d0428130768f835438c8d93edffa2136d..ff4a55fda650e444e302db6846a59de0ebca5447 100644 (file)
public function __construct($config)
{
plugin::plugin($config,NULL);
-
}
public function execute()
diff --git a/gosa-plugins/dak/addons/dak/dak_keyring.tpl b/gosa-plugins/dak/addons/dak/dak_keyring.tpl
--- /dev/null
@@ -0,0 +1,33 @@
+<div class="contentboxh">
+ <p class="contentboxh"><img src="images/launch.png" align="right" alt="[F]">{t}Filter{/t}</p>
+</div>
+<div class="contentboxb">
+
+<table summary="" width="100%" class="contentboxb" style="border-top:1px solid #B0B0B0; padding:0px;">
+ <tr>
+ <td width="50%">
+ <img class="center" alt="" align="middle" border=0 src="images/server.png">
+
+ <LABEL FOR="host">{t}Server{/t}</LABEL>
+ <select name="selected_Server">
+ {foreach from=$Servers item=item key=key}
+ <option {if $key == $selected_Server} selected {/if}
+ value='{$key}'>{$item.SERVER}</option>
+ {/foreach}
+ </select>
+ <input type='submit' name='search' value="{t}Search{/t}">
+ </td>
+ <td width="50%">
+ <input type='FILE' name='import'>
+ <input type='submit' name='import_key' value='{t}Import{/t}'>
+ </td>
+ </tr>
+</table>
+</div>
+
+<br>
+<div style='border-top: solid 1px #BBBBBB;'>
+<div class="contentboxb">
+{$list}
+</div>
+</div>
diff --git a/gosa-plugins/dak/addons/dak/dak_queue.tpl b/gosa-plugins/dak/addons/dak/dak_queue.tpl
--- /dev/null
@@ -0,0 +1,20 @@
+<div class="contentboxh">
+ <p class="contentboxh"><img src="images/launch.png" align="right" alt="[F]">{t}Filter{/t}</p>
+</div>
+<div class="contentboxb">
+
+<table summary="" width="100%" class="contentboxb" style="border-top:1px solid #B0B0B0; padding:0px;">
+ <tr>
+ <td width="33%">
+ <img class="center" alt="" align="middle" border=0 src="images/server.png">
+
+ <LABEL FOR="host">{t}Repositories{/t}</LABEL>
+ <select name="selected_Repository" onChange='document.mainform.submit();'>
+ {foreach from=$Repositories item=item key=key}
+ <option {if $key == $selected_Repository} selected {/if}
+ value='{$key}'>{$item.SERVER} - {$item.RELEASE}</option>
+ {/foreach}
+ </select>
+ </td>
+ </tr>
+</table>