From 3b4bd2536c1ef8827a1571a3a1e775f6f12988c9 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 23 Jul 2010 09:33:30 +0000 Subject: [PATCH] Fixed post handling. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19052 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/goto/class_filterGotoEvents.inc | 196 +++++++++--------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc b/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc index 55416a8f7..240c4d34d 100644 --- a/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc +++ b/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc @@ -1,113 +1,113 @@ get_queued_entries($event_tags,0,9999999,"id"); - if ($o_queue->is_error()){ - msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "

".$o_queue->get_error()), ERROR_DIALOG); - } + /* Get tags that will be used in queue searches */ + $event_tags = array("none"); + foreach($events['SCHEDULED'] as $evt){ + $event_tags[] = $evt['s_Queued_Action']; + } - /* Assign entries by id. - */ - $data= array(); - $ui = get_userinfo(); - - - $ui= get_userinfo(); - $acl_base = $config->current['BASE']; - $acl_is_writeable = preg_match('/w/', $ui->get_permissions($acl_base, "gotomasses/gotomasses", "0")); - $acl_is_removeable = preg_match('/d/', $ui->get_permissions($acl_base, "gotomasses/gotomasses", "0")); - $acl_is_readable = preg_match('/r/', $ui->get_permissions($acl_base, "gotomasses/gotomasses", "0")); - - foreach($entries as $entry){ - - // Detect entry status - $entry['objectClass'][] = "FAKE_OC__gotoEvent"; - - /* If WAITING add priority action - */ - if(in_array($entry['STATUS'],array("waiting")) && $acl_is_writeable){ - $entry['objectClass'][] = "FAKE_OC__prioUp"; - $entry['objectClass'][] = "FAKE_OC__prioDown"; - $entry['objectClass'][] = "FAKE_OC__prioPause"; - } - - /* If PAUSED add resume action - */ - if(in_array($entry['STATUS'],array("paused")) && $acl_is_writeable){ - $entry['objectClass'][] = "FAKE_OC__prioResume"; - } - - /* If PAUSED or WAITING add execution action - */ - if(in_array($entry['STATUS'],array("paused","waiting")) && $acl_is_writeable){ - $entry['objectClass'][] = "FAKE_OC__processNow"; - } - - /* Add logview button, currently ever. - */ - if($acl_is_readable){ - $entry['objectClass'][] = "FAKE_OC__viewLogs"; - } - - /* If PAUSED or WAITING add edit action - */ - if(in_array($entry['STATUS'],array("waiting")) && $acl_is_writeable){ - $entry['objectClass'][] = "FAKE_OC__edit"; - } - - - /* If PROCESSING add abort action - */ - if(in_array($entry['STATUS'],array("processing")) && preg_match("/install/",$entry['HEADERTAG']) && $acl_is_writeable){ - $entry['objectClass'][] = "FAKE_OC__abort"; - } - - /* If WAITING or ERROR add remove action - */ - if( $acl_is_removeable && in_array($entry['STATUS'],array("waiting","error","processed"))){ - $entry['objectClass'][] = "FAKE_OC__remove"; - } - if($acl_is_writeable && in_array($entry['STATUS'],array("processing")) && !preg_match("/install/",$entry['HEADERTAG'])){ - $entry['objectClass'][] = "FAKE_OC__remove"; - } - - $item = array(); - $item['count'] = 0; - $item['EVENT'] = $entry; - $item['dn']= $entry['MACADDRESS'].",".$entry['TIMESTAMP']; - - foreach($entry as $name => $value){ - $item[] = $name; - if(!is_array($value)){ - $item[$name]=array('count' => 1, $value); - }else{ - $item[$name] = $value; - $item[$name]['count'] = count($value); + $entries = $o_queue->get_queued_entries($event_tags,0,9999999,"id"); + if ($o_queue->is_error()){ + msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "

".$o_queue->get_error()), ERROR_DIALOG); } - $item['count'] ++; - } + + /* Assign entries by id. + */ + $data= array(); + $ui = get_userinfo(); + + + $ui= get_userinfo(); + $acl_base = $config->current['BASE']; + $acl_is_writeable = preg_match('/w/', $ui->get_permissions($acl_base, "gotomasses/gotomasses", "0")); + $acl_is_removeable = preg_match('/d/', $ui->get_permissions($acl_base, "gotomasses/gotomasses", "0")); + $acl_is_readable = preg_match('/r/', $ui->get_permissions($acl_base, "gotomasses/gotomasses", "0")); + + foreach($entries as $entry){ + + // Detect entry status + $entry['objectClass'][] = "FAKE_OC__gotoEvent"; + + /* If WAITING add priority action + */ + if(in_array($entry['STATUS'],array("waiting")) && $acl_is_writeable){ + $entry['objectClass'][] = "FAKE_OC__prioUp"; + $entry['objectClass'][] = "FAKE_OC__prioDown"; + $entry['objectClass'][] = "FAKE_OC__prioPause"; + } + + /* If PAUSED add resume action + */ + if(in_array($entry['STATUS'],array("paused")) && $acl_is_writeable){ + $entry['objectClass'][] = "FAKE_OC__prioResume"; + } + + /* If PAUSED or WAITING add execution action + */ + if(in_array($entry['STATUS'],array("paused","waiting")) && $acl_is_writeable){ + $entry['objectClass'][] = "FAKE_OC__processNow"; + } + + /* Add logview button, currently ever. + */ + if($acl_is_readable){ + $entry['objectClass'][] = "FAKE_OC__viewLogs"; + } + + /* If PAUSED or WAITING add edit action + */ + if(in_array($entry['STATUS'],array("waiting")) && $acl_is_writeable){ + $entry['objectClass'][] = "FAKE_OC__edit"; + } + + + /* If PROCESSING add abort action + */ + if(in_array($entry['STATUS'],array("processing")) && preg_match("/install/",$entry['HEADERTAG']) && $acl_is_writeable){ + $entry['objectClass'][] = "FAKE_OC__abort"; + } + + /* If WAITING or ERROR add remove action + */ + if( $acl_is_removeable && in_array($entry['STATUS'],array("waiting","error","processed"))){ + $entry['objectClass'][] = "FAKE_OC__remove"; + } + if($acl_is_writeable && in_array($entry['STATUS'],array("processing")) && !preg_match("/install/",$entry['HEADERTAG'])){ + $entry['objectClass'][] = "FAKE_OC__remove"; + } + + $item = array(); + $item['count'] = 0; + $item['EVENT'] = $entry; + $item['dn']= $entry['MACADDRESS'].",".$entry['TIMESTAMP']; + + foreach($entry as $name => $value){ + $item[] = $name; + if(!is_array($value)){ + $item[$name]=array('count' => 1, $value); + }else{ + $item[$name] = $value; + $item[$name]['count'] = count($value); + } + $item['count'] ++; + } # /* Skip entries which will be removed within the next seconds */ # if(isset($entry['MACADDRESS']) && in_array($entry['MACADDRESS'],$recently_removed)){ # continue; # } - $data[] = $item; - } + $data[] = $item; + } - return($data); - } + return($data); + } } ?> -- 2.30.2