diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc
index fb64e5d3c56c4e18dc73e245477d5335459b6bcb..c0aeae24fe43a4b8ff9d1600d6c2c0e2b6fc3fa4 100644 (file)
class faiHook extends plugin
{
- /* CLI vars */
- var $cli_summary = "Manage server basic objects";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
/* attribute list for save action */
var $ignore_account = TRUE;
$attrs_to_search[] = "FAIstate";
$ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))", $attrs_to_search);
+ $data = array();
while($object = $ldap->fetch()){
+ $data[] = $object;
+ }
+ foreach($data as $object){
/* Skip objects, that are tagged as removed */
if(isset($object['FAIstate'][0])){
}
}
+ /* File download requested */
+ if(isset($_GET['getFAIHook'])){
+ if(isset($this->SubObjects[$_GET['getFAIHook']])){
+ $obj = $this->SubObjects[$_GET['getFAIHook']];
+ $obj = $this->get_object_attributes($obj,$this->sub_Load_Later);
+ send_binary_content($obj['FAIscript'],$obj['cn'].".FAIhook");
+ }
+ }
+
/* Edit entries via GET */
if(isset($_GET['act']) && isset($_GET['id'])){
if($_GET['act'] == "edit" && isset($this->SubObjects[$_GET['id']])){
/* print errors */
if(count($msgs)>0){
foreach($msgs as $msg){
- print_red($msg);
+ msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
}
}else{
/* Check if this object is freezed, in this case hide the delete icon */
if($this->FAIstate == "freeze"){
- $act .= "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("edit")."' alt='"._("edit")."'>";
+ $act .= "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("Edit")."' alt='"._("Edit")."'>";
}else{
- $act .= "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("edit")."' alt='"._("edit")."'>";
+ $act .= "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("Edit")."' alt='"._("Edit")."'>";
if(preg_match("/d/",$acl)){
- $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s' title='"._("delete")."' alt='"._("delete")."'>";
+ $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s' title='"._("Delete")."' alt='"._("Delete")."'>";
}
}
if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
$down = "";
}else{
- $down = "<a href='getFAIscript.php?id=".base64_encode($name['dn'])."'>
+ $down = "<a href='?plug=".$_GET['plug']."&getFAIHook=".$key."'>
<img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
</a>";
}
$ldap = $this->config->get_ldap_link();
FAI::prepare_to_save_FAI_object($this->dn,$this->attrs);
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/hook with dn '%s' failed."),$this->dn));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
+ }
if($this->initially_was_account){
new log("modify","fai/".get_class($this),$this->dn,$this->attributes);
/* We do not need to save untouched objects */
foreach($this->SubObjects as $name => $obj){
- if($obj['status'] == "FreshLoaded"){
- unset($this->SubObjects[$name]);
- }
- }
-
- foreach($this->SubObjects as $name => $obj){
- if($obj['status'] == "delete"){
- $Objects[$name] = $obj;
- }
- }
- foreach($this->SubObjects as $name => $obj){
- if($obj['status'] != "delete"){
+ if($obj['status'] != "FreshLoaded"){
$Objects[$name] = $obj;
}
}
}
/* Tag object */
- $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag);
+ $this->tag_attrs($tmp, $sub_dn, $this->gosaUnitTag);
if($obj['status'] == "delete"){
FAI::prepare_to_save_FAI_object($sub_dn,array(),true);