summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a310e95)
raw | patch | inline | side by side (parent: a310e95)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 29 Jan 2010 08:59:40 +0000 (08:59 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 29 Jan 2010 08:59:40 +0000 (08:59 +0000) |
-Display action buttons now
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15442 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15442 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc b/gosa-plugins/goto/addons/goto/class_filterGotoEvents.inc
index fdb665c1476b4ef72af9fb77688ff1e188319991..0e43a046229908cf6933bcef60e55838694f894a 100644 (file)
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()){
/* 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 b62f0734c4d0820e5d74f05615092a83f01b6c03..c5f5e4d6fbb8a75ed78c839b1c9fc7107eff471e 100644 (file)
$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);
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){
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 = "<img class='center' src='plugins/goto/images/clock.png' alt=''> "._("Waiting");
+ }
+ if($status == "error"){
+ $status = "<img class='center' src='images/false.png' alt=''> "._("Error");
+ }
+ if($status == "processed"){
+ $status = "<img class='center' src='images/true.png' alt=''> "._("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 = "<img class='center' src='images/lists/off.png' alt=''> "._("Locked");
+ /* Show hardware detect? */
+ } elseif ($percent == "goto-hardware-detection") {
+ $status = "<img class='center' src='plugins/goto/images/hardware.png' alt=''> "._("Detection");
+ /* Real percent */
+ } else {
+ if (preg_match('/install/', $headertag)){
+ $status = "<img src='progress.php?x=80&y=13&p=".$progress."' alt=''
+ id='progress_".preg_replace("/:/","_",$mac)."'>";
+ } 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 84bbcb3be2951d2358777c2865eee9a2e5565d09..592acdee2c88fa70b6e85e7c7d4d0e6d0c227e61 100644 (file)
</definition>
<table>
- <layout>|||||||</layout>
+ <layout>|160|160|20|20|20||</layout>
<column>
<label>Target</label>
<label>Status</label>
<sortAttribute>uid</sortAttribute>
<sortType>string</sortType>
- <value>%{filter:filterStatus(TIMESTAMP)}</value>
+ <value>%{filter:filterStatus(STATUS,MACADDRESS,HEADERTAG,PROGRESS)}</value>
<export>true</export>
</column>
<actiontriggers snapshot="true" copypaste="true">
<action>
- <name>newfromtpl</name>
+ <name>prioUp</name>
<type>entry</type>
- <image>images/lists/new.png</image>
- <objectclass>gosaUserTemplate</objectclass>
- <label>New user from template</label>
+ <objectclass>FAKE_OC__prioUp</objectclass>
+ <image>plugins/goto/images/prio_increase.png</image>
+ <label>Up</label>
</action>
<action>
- <name>cp</name>
- <objectclass>!gosaUserTemplate</objectclass>
- <type>copypaste</type>
+ <name>prioDown</name>
+ <type>entry</type>
+ <objectclass>FAKE_OC__prioDown</objectclass>
+ <image>plugins/goto/images/prio_decrease.png</image>
+ <label>Down</label>
</action>
<action>
- <name>edit</name>
+ <name>prioPause</name>
<type>entry</type>
- <objectclass>gosaAccount</objectclass>
- <image>images/lists/edit.png</image>
- <label>Edit user</label>
+ <objectclass>FAKE_OC__prioPause</objectclass>
+ <image>images/status_pause.png</image>
+ <label>Pause</label>
</action>
<action>
- <name>lock</name>
+ <name>processNow</name>
<type>entry</type>
- <objectclass>!gosaUserTemplate</objectclass>
- <image>%{filter:lockImage(userPassword)}</image>
- <acl>uniBonnAccount/password[w]</acl>
- <label>%{filter:lockLabel(userPassword)}</label>
+ <objectclass>FAKE_OC__processNow</objectclass>
+ <image>images/rocket.png</image>
+ <label>Process now</label>
</action>
<action>
- <name>password</name>
+ <name>viewLogs</name>
<type>entry</type>
- <objectclass>!gosaUserTemplate</objectclass>
- <image>plugins/users/images/list_password.png</image>
- <label>Change password</label>
+ <objectclass>FAKE_OC__viewLogs</objectclass>
+ <image>plugins/goto/images/view_logs.png</image>
+ <label>View logs</label>
</action>
<action>
- <name>snapshot</name>
- <type>snapshot</type>
- <objectclass>!gosaUserTemplate</objectclass>
+ <name>edit</name>
+ <type>entry</type>
+ <objectclass>FAKE_OC__edit</objectclass>
+ <image>images/lists/edit.png</image>
+ <label>Edit</label>
</action>
<action>
<name>remove</name>
<type>entry</type>
+ <objectclass>FAKE_OC__remove</objectclass>
<image>images/lists/trash.png</image>
- <objectclass>gosaAccount</objectclass>
- <acl>users/user[d]</acl>
- <label>Remove user</label>
+ <label>Remove</label>
</action>
</actiontriggers>
</list>
+