diff --git a/plugins/addons/tasks/class_tasksMail.inc b/plugins/addons/tasks/class_tasksMail.inc index 5b9ec7603551afbd8ccbbf4a7f815174aa119e30..3eef89891ebb13f707250b44b1fd4995df96aae3 100644 --- a/plugins/addons/tasks/class_tasksMail.inc +++ b/plugins/addons/tasks/class_tasksMail.inc @@ -165,7 +165,7 @@ class tasksMail extends simplePlugin $id ++; // Here we create the object taskGranular - $tabobject = objects::create('TasksGranular'); + $tabObject = objects::create('TasksGranular'); // remove 'dn' keeping only 'cn' $rmDn = preg_replace('/(?=,).*/', '', $this->dn); @@ -184,20 +184,20 @@ class tasksMail extends simplePlugin ]; foreach ($values as $tab => $tabvalues) { - if (!isset($tabobject->by_object[$tab])) { + if (!isset($tabObject->by_object[$tab])) { echo "Error tab does not contains attributes values" .PHP_EOL; } - $error = $tabobject->by_object[$tab]->deserializeValues($tabvalues); + $error = $tabObject->by_object[$tab]->deserializeValues($tabvalues); if ($error !== TRUE) { echo 'Error during deserializing' .$error .PHP_EOL; } - $tabobject->current = $tab; - $tabobject->update(); - $tabobject->loadTabs(); + $tabObject->current = $tab; + $tabObject->update(); + $tabObject->loadTabs(); } - $errors = $tabobject->save(); + $errors = $tabObject->save(); if (!empty($errors)) { $show_error = new SimplePluginError($this, htmlescape(sprintf(_('Error : "%s", already exist ! Editing existing tasks is forbidden.'), $subTaskName))); $show_error->display(); diff --git a/plugins/admin/tasks/class_tasksDashboard.inc b/plugins/admin/tasks/class_tasksDashboard.inc index e75982ff3c2952a255d9311ee3dae2b54a831076..45da42c82822d43a000d8cbcfff7c2bfe5c3d997 100644 --- a/plugins/admin/tasks/class_tasksDashboard.inc +++ b/plugins/admin/tasks/class_tasksDashboard.inc @@ -29,6 +29,7 @@ class tasksDashboard extends management ['Column', ['attributes' => 'fdTasksGranularMail', 'label' => 'Email']], ['TasksColumn', ['attributes' => 'fdTasksGranularSchedule', 'label' => 'Schedule']], ['TasksColumn', ['attributes' => 'fdTasksGranularStatus', 'label' => 'Status']], + ['ActionsColumn', ['label' => 'Actions']], ]; // No modification tools are required. @@ -52,14 +53,54 @@ class tasksDashboard extends management protected function setUpFilter (array $filterElementDefinitions) { - $this->filter = new tasksDashboardFilter($this, NULL, $filterElementDefinitions); + $this->filter = new tasksDashboardFilter($this, NULL, $filterElementDefinitions); } // Allowing us to add additional actions and remove unrequired ones. protected function configureActions () { - // Leaving empty as no default action allowed. + $this->registerAction( + new Action( + 'tasksRenew', + _('Renew the selected task'), + 'geticon.php?context=actions&icon=view-refresh&size=16', + '+', + 'tasksRenew' + ) + ); + + $this->actions['tasksRenew']->setSeparator(TRUE); + $this->actions['tasksRenew']->setEnableFunction([$this, 'setTasksActionStatus']); + } + + // This method is triggered by the user action click on tasksRenew + function tasksRenew (array $action) + { + foreach ((array)$action['targets'] as $dn) { + $this->tasksUpdate($dn, 1); + } + } + + function tasksUpdate ($dn) + { + $tabObject = objects::open($dn, 'tasksGranular'); + $tabObject->by_object['tasksGranular']->attributesAccess['fdTasksGranularStatus']->setValue(1); + $errors = $tabObject->save(); + + if (!empty($errors)) { + $show_error = new SimplePluginError($this, htmlescape(sprintf(_('Error updating: "%s" !.'), $dn))); + $show_error->display(); + } + } + + // This method is triggered during initiation of the dashboard, allowing proper icons status + function setTasksActionStatus () : BOOL + { + echo "setTasksActionStatus" .PHP_EOL; + return TRUE; + } + // End of Class } diff --git a/plugins/admin/tasks/class_tasksManagement.inc b/plugins/admin/tasks/class_tasksManagement.inc index 5647d801dcfc9064b557dd4459d1e418a857bec0..3d5e81417daf62c79c19dd5e572debc8b2f4aeba 100644 --- a/plugins/admin/tasks/class_tasksManagement.inc +++ b/plugins/admin/tasks/class_tasksManagement.inc @@ -23,7 +23,7 @@ class tasksManagement extends management protected $skipCpHandler = TRUE; - /* + /* * LinkColumn exists by class collumn * TasksColumn is a new class for Tasks bassed on argonaut column definition */