Verified Commit c63884be authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: Feat(Tasks) - Dashboard v0.2

Adding some features to create dynamically tasks
dashboard. Allowing tasks mail to create granular objects.
Showing with 107 additions and 51 deletions
+107 -51
...@@ -328,6 +328,35 @@ attributetype ( 1.3.6.1.4.1.38414.89.1.8 NAME 'fdTasksEmailSender' ...@@ -328,6 +328,35 @@ attributetype ( 1.3.6.1.4.1.38414.89.1.8 NAME 'fdTasksEmailSender'
EQUALITY caseExactMatch EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
##### Tasks Granular #####
attributetype ( 1.3.6.1.4.1.38414.89.1.9 NAME 'fdTasksGranularStatus'
DESC 'Fusion Directory - Task Status'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
attributetype ( 1.3.6.1.4.1.38414.89.1.10 NAME 'fdTasksGranularSchedule'
DESC 'Scheduling of the Task - required processed date'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
attributetype ( 1.3.6.1.4.1.38414.89.1.11 NAME 'fdTasksGranularMaster'
DESC 'Fusion Directory - Tasks Master objects'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.89.1.12 NAME 'fdTasksGranularType'
DESC 'Fusion Directory - Tasks Type'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.89.1.13 NAME 'fdTasksGranularMail'
DESC 'Fusion Directory - Task Mail'
EQUALITY caseExactMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
##### Classes ##### ##### 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
...@@ -422,3 +451,8 @@ objectclass (1.3.6.1.4.1.38414.89.2.2 NAME 'fdTasksMail' ...@@ -422,3 +451,8 @@ objectclass (1.3.6.1.4.1.38414.89.2.2 NAME 'fdTasksMail'
SUP top AUXILIARY SUP top AUXILIARY
MUST ( fdTasksMailObject $ fdTasksEmailSender ) MUST ( fdTasksMailObject $ fdTasksEmailSender )
MAY ( fdTasksMailUsers $ fdTasksEmailsFromDN ) ) MAY ( fdTasksMailUsers $ fdTasksEmailsFromDN ) )
objectclass (1.3.6.1.4.1.38414.89.2.3 NAME 'fdTasksGranular'
DESC 'FusionDirectory - Tasks granular objects'
MUST ( fdTasksGranularMaster $ cn $ fdTasksGranularMail $
fdTasksGranularType $ fdTasksGranularSchedule $ fdTasksGranularStatus ))
...@@ -55,6 +55,7 @@ class tasks extends simplePlugin ...@@ -55,6 +55,7 @@ class tasks extends simplePlugin
_('Schedule'), '', _('Schedule'), '',
'fdTasksScheduleDate', FALSE 'fdTasksScheduleDate', FALSE
), ),
new HiddenAttribute('fdTasksStatus', TRUE, '1', '', 'Status', 'Status of the task'), new HiddenAttribute('fdTasksStatus', TRUE, '1', '', 'Status', 'Status of the task'),
new HiddenAttribute('fdTasksCreationDate', TRUE, date("Y-m-d h:i:sa"), '', 'StartDate', 'Start Date And Time Of A Task'), new HiddenAttribute('fdTasksCreationDate', TRUE, date("Y-m-d h:i:sa"), '', 'StartDate', 'Start Date And Time Of A Task'),
] ]
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class tasksGranular extends tasks class tasksGranular extends simplePlugin
{ {
static function plInfo (): array static function plInfo (): array
...@@ -27,11 +27,11 @@ class tasksGranular extends tasks ...@@ -27,11 +27,11 @@ class tasksGranular extends tasks
return [ return [
'plShortName' => _('Tasks Granular'), 'plShortName' => _('Tasks Granular'),
'plDescription' => _('Granular tasks mangement allowing details reports'), 'plDescription' => _('Granular tasks mangement allowing details reports'),
'plObjectClass' => ['fdTasks'], 'plObjectClass' => ['fdTasksGranular'],
'plFilter' => '(objectClass=fdTasks)', 'plFilter' => '(objectClass=fdTasksGranular)',
'plPriority' => 41, 'plPriority' => 41,
'plObjectType' => ['tasksGranular' => [ 'plObjectType' => ['tasksGranular' => [
'name' => _('Tasks'), 'name' => _('TasksGranular'),
'ou' => get_ou('tasksRDN'), 'ou' => get_ou('tasksRDN'),
'icon' => 'geticon.php?context=applications&icon=dsa&size=16', 'icon' => 'geticon.php?context=applications&icon=dsa&size=16',
]], ]],
...@@ -43,41 +43,23 @@ class tasksGranular extends tasks ...@@ -43,41 +43,23 @@ class tasksGranular extends tasks
{ {
return [ return [
// Attributes are grouped by section // Attributes are grouped by section
'tasks' => [ 'tasksGranular' => [
'name' => _('List of sub tasks'), 'name' => _('Tasks Granular'),
'attrs' => [ 'attrs' => [
new StringAttribute( new StringAttribute(
_('Task Name'), _('Name for this task'), _('Task Granular Name'), _('Name for this task'),
'cn', TRUE 'cn', TRUE
), ),
new DateTimeAttribute( new HiddenAttribute('fdTasksGranularStatus', TRUE, '1', '', 'Status', 'Status of the task'),
new HiddenAttribute('fdTasksGranularMaster', TRUE, '', '', 'Master CN', 'Name of the Master task'),
new HiddenAttribute('fdTasksGranularType', TRUE, '', '', 'Type', 'Type of the task'),
new HiddenAttribute('fdTasksGranularMail', TRUE, '', '', 'Mail', 'Mail of the task'),
new DateTimeAttribute(
_('Schedule'), '', _('Schedule'), '',
'fdTasksScheduleDate', FALSE 'fdTasksGranularSchedule', FALSE
),
new HiddenAttribute('fdTasksStatus', TRUE, '1', '', 'Status', 'Status of the task'),
new HiddenAttribute('fdTasksCreationDate', TRUE, date("Y-m-d h:i:sa"), '', 'StartDate', 'Start Date And Time Of A Task'),
new SetAttribute(
new CompositeAttribute(
_('Macro definitions'),
'fdSubTasks',
[
new SelectAttribute(
'', _('Macro type'),
'fdSubTasks', TRUE
),
new StringAttribute(
_('Macros User Definition'), _('Macro that will be used'),
'fdSubTasks', TRUE, ''
),
],
'/^{(.+)}(.*)$/',
'{%s}%s',
'',
_('To be defined properly')
) )
),
] ]
], ]
]; ];
} }
...@@ -86,13 +68,9 @@ class tasksGranular extends tasks ...@@ -86,13 +68,9 @@ class tasksGranular extends tasks
global $config; global $config;
parent::__construct($dn, $object, $parent, $mainTab); parent::__construct($dn, $object, $parent, $mainTab);
// As this class inherit from tasks, attributes must not be seen or be modifiable $this->attributesAccess['fdTasksGranularMaster']->setValue('testMaster');
$this->attributesAccess['cn']->setVisible(FALSE); $this->attributesAccess['fdTasksGranularType']->setValue('testType');
$this->attributesAccess['fdTasksScheduleDate']->setVisible(FALSE); $this->attributesAccess['fdTasksGranularMail']->setValue('testMail');
$this->read_only = TRUE;
} }
} }
...@@ -56,7 +56,7 @@ class tasksMail extends simplePlugin ...@@ -56,7 +56,7 @@ class tasksMail extends simplePlugin
'fdTasksMailObject', FALSE 'fdTasksMailObject', FALSE
), ),
new HiddenArrayAttribute('fdTasksEmailsFromDN', FALSE, ''), new HiddenArrayAttribute('fdTasksEmailsFromDN', FALSE, ''),
] ]
], ],
'From Component' => [ 'From Component' => [
'name' => _('Sender Address'), 'name' => _('Sender Address'),
...@@ -93,7 +93,6 @@ class tasksMail extends simplePlugin ...@@ -93,7 +93,6 @@ class tasksMail extends simplePlugin
} }
asort($tmpSearch); asort($tmpSearch);
$this->attributesAccess['fdTasksMailObject']->setChoices(array_keys($tmpSearch), array_values($tmpSearch)); $this->attributesAccess['fdTasksMailObject']->setChoices(array_keys($tmpSearch), array_values($tmpSearch));
} }
/* /*
...@@ -140,4 +139,49 @@ class tasksMail extends simplePlugin ...@@ -140,4 +139,49 @@ class tasksMail extends simplePlugin
} }
} }
function save (): array
{
$this->generateSlaveTasks();
$errors = parent::save();
return $errors;
}
public function generateSlaveTasks () : void
{
$tabobject = objects::create('TasksGranular');
$infos = objects::infos('TasksGranular');
$emails = $this->attributesAccess['fdTasksEmailsFromDN']->getValue();
// Testing purposes
$id = 1;
if (isset($emails) && !empty($emails)) {
foreach ($emails as $email) {
$id += $id;
$values['tasksGranular'] = [
"cn" => "testCN-.$id",
"fdTasksGranularType" => 'Mail Object',
];
foreach ($values as $tab => $tabvalues) {
if (!isset($tabobject->by_object[$tab])) {
echo "Error tabObject by object tab is not set";
}
$error = $tabobject->by_object[$tab]->deserializeValues($tabvalues);
if ($error !== TRUE) {
echo $error;
}
$tabobject->current = $tab;
$tabobject->update();
$tabobject->loadTabs();
}
$errors = $tabobject->save();
if (!empty($errors)) {
print_r($errors);
}
}
}
}
} }
...@@ -18,18 +18,17 @@ ...@@ -18,18 +18,17 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
class tasksDashboard extends tasksManagement class tasksDashboard extends management
{ {
// Actions collumn are removed compared to parent // Actions collumn are removed compared to parent
public static $columns = [ public static $columns = [
['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']], ['LinkColumn', ['attributes' => 'cn', 'label' => 'Tasks']],
//below fdTasksMailObject must be change to have a type defined within task creation (new ldap attributes ?hidden) ['Column', ['attributes' => 'fdTasksGranularMaster', 'label' => 'Master Task']],
['TasksColumn', ['attributes' => 'fdTasksMailObject', 'label' => 'Types']], ['Column', ['attributes' => 'fdTasksGranularType', 'label' => 'Types']],
['TasksColumn', ['attributes' => 'fdTasksScheduleDate', 'label' => 'Schedule']], ['Column', ['attributes' => 'fdTasksGranularMail', 'label' => 'Email']],
//below fdTasksStatus attribute needs to be calculated based on the type of the task. ['Column', ['attributes' => 'fdTasksGranularSchedule', 'label' => 'Schedule']],
['TasksColumn', ['attributes' => 'fdTasksStatus', 'label' => 'Status']], ['Column', ['attributes' => 'fdTasksGranularStatus', 'label' => 'Status']],
['Column', ['attributes' => 'fdTasksCreationDate', 'label' => 'Creation Date']]
]; ];
// No modification tools are required // No modification tools are required
......
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