From 2bfe68946ef9a64a60c76692c73163691d4225cb Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 29 Jan 2010 08:59:40 +0000 Subject: [PATCH] Updated gotomasses -Display action buttons now git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15442 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/goto/class_filterGotoEvents.inc | 80 +++++++++++++++++-- .../goto/addons/goto/class_gotomasses.inc | 51 +++++++++--- gosa-plugins/goto/addons/goto/deploy-list.xml | 59 +++++++------- 3 files changed, 146 insertions(+), 44 deletions(-) diff --git a/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc b/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc index fdb665c14..0e43a0462 100644 --- a/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc +++ b/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc @@ -2,11 +2,16 @@ class filterGotoEvents extends filterLDAP { static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "") { - + global $config; $o_queue = new gosaSupportDaemon(TRUE,5); $events = DaemonEvent::get_event_types( SYSTEM_EVENT); + /* Get tags that will be used in queue searches */ + $event_tags = array("none"); + foreach($events['SCHEDULED'] as $evt){ + $event_tags[] = $evt['s_Queued_Action']; + } $entries = $o_queue->get_queued_entries($event_tags,0,9999999,"id"); if ($o_queue->is_error()){ @@ -16,26 +21,91 @@ class filterGotoEvents extends filterLDAP { /* 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['dn']= implode($entry,", item="); + $item['dn']= $entry['MACADDRESS'].",".$entry['TIMESTAMP']; foreach($entry as $name => $value){ $item[] = $name; - $item[$name]=array('count' => 1, $value); + 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'],$this->recently_removed)){ +# if(isset($entry['MACADDRESS']) && in_array($entry['MACADDRESS'],$recently_removed)){ # continue; # } $data[] = $item; } + return($data); } } diff --git a/gosa-plugins/goto/addons/goto/class_gotomasses.inc b/gosa-plugins/goto/addons/goto/class_gotomasses.inc index b62f0734c..c5f5e4d6f 100644 --- a/gosa-plugins/goto/addons/goto/class_gotomasses.inc +++ b/gosa-plugins/goto/addons/goto/class_gotomasses.inc @@ -63,6 +63,7 @@ class gotomasses extends management $headpage->registerElementFilter("filterTask","gotomasses::filterTask"); $headpage->registerElementFilter("filterPeriod","gotomasses::filterPeriod"); $headpage->registerElementFilter("filterSchedule","gotomasses::filterSchedule"); + $headpage->registerElementFilter("filterStatus","gotomasses::filterStatus"); $headpage->setFilter($filter); parent::__construct($config, $ui, "Events", $headpage); @@ -103,7 +104,7 @@ class gotomasses extends management static function filterPeriod($periodic=array()) { - $period = ""; + $period = " -"; if(isset($periodic[0]) && !preg_match("/none/i",$periodic[0])){ $tmp = explode("_", $periodic[0]); if(count($tmp) == 2){ @@ -121,24 +122,52 @@ class gotomasses extends management return(date("d.m.Y H:i:s",strtotime($stamp[0]))); } } - - - - - - - - - - + static function filterStatus($status, $mac,$headertag, $progress) + { + $mac = $mac[0]; + $status = $status[0]; + $progress = $progress[0]; + $headertag = $headertag[0]; + if($status == "waiting"){ + $status = " "._("Waiting"); + } + if($status == "error"){ + $status = " "._("Error"); + } + if($status == "processed"){ + $status = " "._("Processed"); + } + /* Special handling for all entries that have + STATUS == "processing" && PROGRESS == NUMERIC + */ + if($status == "processing" && $progress){ + $percent = $progress; + /* Show activation? */ + if ($percent == "goto-activation"){ + $status = " "._("Locked"); + /* Show hardware detect? */ + } elseif ($percent == "goto-hardware-detection") { + $status = " "._("Detection"); + /* Real percent */ + } else { + if (preg_match('/install/', $headertag)){ + $status = ""; + } else { + $status = preg_replace('/ /', ' ', _("in progress")); + } + } + } + return($status); + } diff --git a/gosa-plugins/goto/addons/goto/deploy-list.xml b/gosa-plugins/goto/addons/goto/deploy-list.xml index 84bbcb3be..592acdee2 100644 --- a/gosa-plugins/goto/addons/goto/deploy-list.xml +++ b/gosa-plugins/goto/addons/goto/deploy-list.xml @@ -21,7 +21,7 @@ - ||||||| + |160|160|20|20|20|| @@ -59,7 +59,7 @@ uid string - %{filter:filterStatus(TIMESTAMP)} + %{filter:filterStatus(STATUS,MACADDRESS,HEADERTAG,PROGRESS)} true @@ -181,59 +181,62 @@ - newfromtpl + prioUp entry - images/lists/new.png - gosaUserTemplate - + FAKE_OC__prioUp + plugins/goto/images/prio_increase.png + - cp - !gosaUserTemplate - copypaste + prioDown + entry + FAKE_OC__prioDown + plugins/goto/images/prio_decrease.png + - edit + prioPause entry - gosaAccount - images/lists/edit.png - + FAKE_OC__prioPause + images/status_pause.png + - lock + processNow entry - !gosaUserTemplate - %{filter:lockImage(userPassword)} - uniBonnAccount/password[w] - + FAKE_OC__processNow + images/rocket.png + - password + viewLogs entry - !gosaUserTemplate - plugins/users/images/list_password.png - + FAKE_OC__viewLogs + plugins/goto/images/view_logs.png + - snapshot - snapshot - !gosaUserTemplate + edit + entry + FAKE_OC__edit + images/lists/edit.png + remove entry + FAKE_OC__remove images/lists/trash.png - gosaAccount - users/user[d] - + + -- 2.30.2