diff --git a/contrib/openldap/core-fd.schema b/contrib/openldap/core-fd.schema index 8bd590c37bc765e50cf58df8ea38572bd479d18a..8b0eb33f9b321b9679ef65c5bb1e35b3cafd6663 100644 --- a/contrib/openldap/core-fd.schema +++ b/contrib/openldap/core-fd.schema @@ -285,7 +285,15 @@ attributetype ( 1.3.6.1.4.1.38414.88.1.26 NAME 'fdMTInvitationReplyTo' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) -# Classes +##### Tasks Attributes ##### + +attributetype ( 1.3.6.1.4.1.38414.89.1.1 NAME 'fdTasksMailObject' + DESC 'Fusion Directory - Tasks for mail template objects' + EQUALITY caseExactMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 + SINGLE-VALUE ) + +##### Classes ##### objectclass ( 1.3.6.1.4.1.10098.1.2.1.19.4 NAME 'gosaDepartment' SUP top AUXILIARY DESC 'GOsa - Class to mark Departments for GOsa' @@ -322,7 +330,6 @@ objectclass ( 1.3.6.1.4.1.38414.62.2.2 NAME 'fdSubscriptionInformation' SUP top DESC 'FusionDirectory - Information about current subscription' MUST ( cn ) MAY ( uid $ fdSubscriptionStartDate $ fdSubscriptionEndDate $ fdSubscriptionType $ fdSubscriptionContractId $ fdSubscriptionName )) -<<<<<<< HEAD # Classes Macros Related @@ -332,8 +339,6 @@ objectclass ( 1.3.6.1.4.1.38414.90.2.1 NAME 'fdMacroConf' MUST ( cn ) MAY ( fdMacroRDN $ fdMacroMail $ fdMacroInvitations $ fdMacroUserRecovery $ fdMacroUserReminder ) ) -======= - ### Mail Template Related Object Class ### objectclass (1.3.6.1.4.1.38414.88.2.1 NAME 'fdMailTemplate' @@ -369,4 +374,16 @@ objectclass ( 1.3.6.1.4.1.38414.88.2.5 NAME 'fdMailTemplateInvitations' SUP top AUXILIARY MUST ( cn $ fdMTInvitationEmailSubject $ fdMTInvitationEmailContent) MAY ( fdMTInvitationReplyTo ) ) ->>>>>>> 6205-enhancement-mail-template-object-invitations + +### Tasks Related Object Class ### + +objectclass (1.3.6.1.4.1.38414.89.2.1 NAME 'fdTasks' + DESC 'FusionDirectory - Tasks objects' + MUST ( cn ) + MAY ( ) ) + +objectclass (1.3.6.1.4.1.38414.89.2.2 NAME 'fdTasksMail' + DESC 'FusionDirectory - Tasks objects Mail' + SUP top AUXILIARY + MUST ( cn ) + MAY ( fdTasksMailObject ) ) diff --git a/plugins/addons/tasks/class_tasks.inc b/plugins/addons/tasks/class_tasks.inc index a51c7e02d7e3f87354cc69a8af3f5a5cb014d3b1..adada3bc6fea0bfe47c1b8eb339c477639c9acd8 100644 --- a/plugins/addons/tasks/class_tasks.inc +++ b/plugins/addons/tasks/class_tasks.inc @@ -48,7 +48,7 @@ class tasks extends simplePlugin 'name' => _('Tasks Generic'), 'attrs' => [ new StringAttribute( - _('Task Name'), _('Mail Template Name'), + _('Task Name'), _('Name for this task'), 'cn', TRUE ), ] diff --git a/plugins/addons/tasks/class_tasksColumn.inc b/plugins/addons/tasks/class_tasksColumn.inc new file mode 100644 index 0000000000000000000000000000000000000000..97e2be359d5a2d8d37f0e133d7a92688d8dde517 --- /dev/null +++ b/plugins/addons/tasks/class_tasksColumn.inc @@ -0,0 +1,93 @@ +<?php +/* + This code is part of FusionDirectory (http://www.fusiondirectory.org/) + + Copyright (C) 2011-2022 FusionDirectory + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +/*! + * \brief Column rendering Tasks + */ +class tasksColumn extends Column + + +{ + protected function renderSingleValue (ListingEntry $entry, string $value): string + { + if ($value == '') { + return ' '; + } else { + switch ($this->attributes[0]) { + case 'TYPE': + return static::filterTypes($value, $entry['PROGRESS']); + case 'TIMESTAMP': + return static::filterSchedule($value); + case 'STATUS': + return static::filterStatus($entry->row, $value, $entry['SUBSTATUS']); + default: + return parent::renderSingleValue($entry, $value); + } + } + } + + static function filterTypes (string $name, string $targetdn, string $targettype): string + { + $text = ''; + if (!empty($name) && ($name != 'none')) { + $text = $name; + } + if (!empty($targetdn) && !empty($targettype)) { + return objects::link($targetdn, $targettype, '', $text, TRUE); + } else { + return htmlescape($text); + } + } + + static function filterSchedule (string $stamp): string + { + if ($stamp == '19700101000000') { + return htmlescape(_('immediately')); + } else { + return htmlescape(date('d.m.Y H:i:s', strtotime($stamp))); + } + } + + static function filterStatus (int $row, string $status, string $substatus): string + { + if ($status == 'waiting') { + $status = '<img class="center" src="geticon.php?context=status&icon=task-waiting&size=16" alt="clock"/> '.htmlescape(_('Waiting')); + } + if ($status == 'error') { + $status = '<input class="center" type="image" src="geticon.php?context=status&icon=task-failure&size=16" title="'.htmlescape(_('Show error')).'" '. + 'name="listing_showError_'.$row.'" style="padding:1px"/>'.htmlescape(_('Error')); + } + if ($status == 'processed') { + $status = '<img class="center" src="geticon.php?context=status&icon=task-complete&size=16" alt=""/> '.htmlescape(_('Processed')); + } + + /* Special handling for all entries that have + STATUS == "processing" && PROGRESS == NUMERIC + */ + if ($status == 'processing' && $substatus) { + $status = $substatus; + } elseif ($status == 'processing') { + $status = preg_replace('/ /', ' ', htmlescape(_('in progress'))); + } + + return $status; + } +} diff --git a/plugins/addons/tasks/class_tasksManagement.inc b/plugins/addons/tasks/class_tasksManagement.inc index d5a62a9e8d6e67c5d75a1d0cf80015606a7f1458..6f746aef9a68c8b007ab299bd5744497122560f9 100644 --- a/plugins/addons/tasks/class_tasksManagement.inc +++ b/plugins/addons/tasks/class_tasksManagement.inc @@ -21,12 +21,16 @@ class tasksManagement extends management { - /* Default columns */ - + /* + * LinkColun exists by class collumn + * TasksColumn is a new class for Tasks bassed on argonaut column definition + */ public static $columns = [ - ['ObjectTypeColumn', []], - ['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']], - ['ActionsColumn', ['label' => 'Actions']], + ['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']], + ['tasksColumn', ['attributes' => 'TYPE', 'label' => 'Types']], + ['tasksColumn', ['attributes' => 'TIMESTAMP', 'label' => 'Schedule']], + ['tasksColumn', ['attributes' => 'STATUS', 'label' => 'Status']], + ['ActionsColumn', ['label' => 'Actions']], ]; static function plInfo ()