Verified Commit 3d4bfc79 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(Tasks) - Adds mail task, proper columns

Adds management required columns, back processing still has to be
developped
Showing with 125 additions and 11 deletions
+125 -11
...@@ -285,7 +285,15 @@ attributetype ( 1.3.6.1.4.1.38414.88.1.26 NAME 'fdMTInvitationReplyTo' ...@@ -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 SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE ) 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 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' 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 ...@@ -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' DESC 'FusionDirectory - Information about current subscription'
MUST ( cn ) MUST ( cn )
MAY ( uid $ fdSubscriptionStartDate $ fdSubscriptionEndDate $ fdSubscriptionType $ fdSubscriptionContractId $ fdSubscriptionName )) MAY ( uid $ fdSubscriptionStartDate $ fdSubscriptionEndDate $ fdSubscriptionType $ fdSubscriptionContractId $ fdSubscriptionName ))
<<<<<<< HEAD
# Classes Macros Related # Classes Macros Related
...@@ -332,8 +339,6 @@ objectclass ( 1.3.6.1.4.1.38414.90.2.1 NAME 'fdMacroConf' ...@@ -332,8 +339,6 @@ objectclass ( 1.3.6.1.4.1.38414.90.2.1 NAME 'fdMacroConf'
MUST ( cn ) MUST ( cn )
MAY ( fdMacroRDN $ fdMacroMail $ fdMacroInvitations $ fdMacroUserRecovery $ fdMacroUserReminder ) ) MAY ( fdMacroRDN $ fdMacroMail $ fdMacroInvitations $ fdMacroUserRecovery $ fdMacroUserReminder ) )
=======
### Mail Template Related Object Class ### ### Mail Template Related Object Class ###
objectclass (1.3.6.1.4.1.38414.88.2.1 NAME 'fdMailTemplate' 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' ...@@ -369,4 +374,16 @@ objectclass ( 1.3.6.1.4.1.38414.88.2.5 NAME 'fdMailTemplateInvitations'
SUP top AUXILIARY SUP top AUXILIARY
MUST ( cn $ fdMTInvitationEmailSubject $ fdMTInvitationEmailContent) MUST ( cn $ fdMTInvitationEmailSubject $ fdMTInvitationEmailContent)
MAY ( fdMTInvitationReplyTo ) ) 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 ) )
...@@ -48,7 +48,7 @@ class tasks extends simplePlugin ...@@ -48,7 +48,7 @@ class tasks extends simplePlugin
'name' => _('Tasks Generic'), 'name' => _('Tasks Generic'),
'attrs' => [ 'attrs' => [
new StringAttribute( new StringAttribute(
_('Task Name'), _('Mail Template Name'), _('Task Name'), _('Name for this task'),
'cn', TRUE 'cn', TRUE
), ),
] ]
......
<?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 '&nbsp;';
} 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&amp;icon=task-waiting&amp;size=16" alt="clock"/>&nbsp;'.htmlescape(_('Waiting'));
}
if ($status == 'error') {
$status = '<input class="center" type="image" src="geticon.php?context=status&amp;icon=task-failure&amp;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&amp;icon=task-complete&amp;size=16" alt=""/>&nbsp;'.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('/ /', '&nbsp;', htmlescape(_('in progress')));
}
return $status;
}
}
...@@ -21,12 +21,16 @@ ...@@ -21,12 +21,16 @@
class tasksManagement extends management 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 = [ public static $columns = [
['ObjectTypeColumn', []], ['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']],
['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']], ['tasksColumn', ['attributes' => 'TYPE', 'label' => 'Types']],
['ActionsColumn', ['label' => 'Actions']], ['tasksColumn', ['attributes' => 'TIMESTAMP', 'label' => 'Schedule']],
['tasksColumn', ['attributes' => 'STATUS', 'label' => 'Status']],
['ActionsColumn', ['label' => 'Actions']],
]; ];
static function plInfo () static function plInfo ()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment