diff --git a/ajax-operations.php b/ajax-operations.php index ce4d5b6..489cc1d 100644 --- a/ajax-operations.php +++ b/ajax-operations.php @@ -1,6 +1,6 @@ GetLifecycleImage($aStimuliToHide, $bHideInternalStimuli); - - // Send content - switch($sOutputFormat) - { - case 'base64': - header('Content-type: text/plain'); - echo base64_encode(file_get_contents($sImageFilePath)); - break; - - case 'binary': - default: - header('Content-type: image/png'); - echo file_get_contents($sImageFilePath); - break; - } - - - // If image in temp. dir., we delete it (means that it's not the default image) - if(stripos($sImageFilePath, GraphvizGenerator::$sTmpFolderPath) !== false) - { - @unlink($sImageFilePath); - } } catch(Exception $oException) { - http_response_code(500); + http_response_code(Response::HTTP_INTERNAL_SERVER_ERROR); header('Content-type: text/html'); echo "

{$oException->getMessage()}

"; -} - -//$oController = new AjaxOperationsController(MODULESROOT.ConfigHelper::GetModuleCode().'/view', ConfigHelper::GetModuleCode()); -// -//// Allow parallel execution -//session_write_close(); -// -//$oController->HandleOperation(); +} \ No newline at end of file diff --git a/asset/css/default.scss b/asset/css/default.scss index e3789d0..2b838a5 100644 --- a/asset/css/default.scss +++ b/asset/css/default.scss @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2013-2020 Combodo SARL + * Copyright (C) 2013-2024 Combodo SAS * * This file is part of iTop. * diff --git a/asset/js/workflow_graphical_view.js b/asset/js/workflow_graphical_view.js index 677224e..5f38a20 100644 --- a/asset/js/workflow_graphical_view.js +++ b/asset/js/workflow_graphical_view.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2020 Combodo SARL + * Copyright (C) 2013-2024 Combodo SAS * * This file is part of iTop. * diff --git a/asset/js/workflow_graphical_view_backoffice.js b/asset/js/workflow_graphical_view_backoffice.js index 33c64e0..47d468f 100644 --- a/asset/js/workflow_graphical_view_backoffice.js +++ b/asset/js/workflow_graphical_view_backoffice.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2021 Combodo SARL + * Copyright (C) 2013-2024 Combodo SAS * * This file is part of iTop. * diff --git a/asset/js/workflow_graphical_view_portal.js b/asset/js/workflow_graphical_view_portal.js index afd927b..d1e9b40 100644 --- a/asset/js/workflow_graphical_view_portal.js +++ b/asset/js/workflow_graphical_view_portal.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2020 Combodo SARL + * Copyright (C) 2013-2024 Combodo SAS * * This file is part of iTop. * diff --git a/cs.dict.combodo-workflow-graphical-view.php b/cs.dict.combodo-workflow-graphical-view.php index d5e3842..2d46930 100644 --- a/cs.dict.combodo-workflow-graphical-view.php +++ b/cs.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/da.dict.combodo-workflow-graphical-view.php b/da.dict.combodo-workflow-graphical-view.php index fbd17e0..85b17a8 100644 --- a/da.dict.combodo-workflow-graphical-view.php +++ b/da.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/datamodel.combodo-workflow-graphical-view.xml b/datamodel.combodo-workflow-graphical-view.xml index c146df5..d806adf 100644 --- a/datamodel.combodo-workflow-graphical-view.xml +++ b/datamodel.combodo-workflow-graphical-view.xml @@ -1,5 +1,5 @@ - + false diff --git a/de.dict.combodo-workflow-graphical-view.php b/de.dict.combodo-workflow-graphical-view.php index 35fde2f..f1ecb17 100644 --- a/de.dict.combodo-workflow-graphical-view.php +++ b/de.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Hoppla! Der Lebenszyklus konnte nicht erstellt werden. Überprüfen Sie das Error-Log für weitere Informationen.', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Es kann kein Lebenszyklusdiagramm für %1$s erstellt werden, da es kein Statusattribut hat.', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Ablauf anzeigen', - 'workflow-graphical-view:UI:Modal:Title' => 'Ablauf', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Aktueller Status', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'Benutzer-Statusübergänge', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Interne Statusübergänge', 'workflow-graphical-view:Error:NoStateAttribute' => 'Es kann kein Lebenszyklusdiagramm für %1$s erstellt werden, da es kein Statusattribut hat.', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Hoppla! Der Lebenszyklus konnte nicht erstellt werden. Überprüfen Sie das Error-Log für weitere Informationen.', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'Benutzer-Statusübergänge', + 'workflow-graphical-view:UI:Modal:Title' => 'Ablauf', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Es kann kein Lebenszyklusdiagramm für %1$s erstellt werden, da es kein Statusattribut hat.', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Hoppla! Der Lebenszyklus konnte nicht erstellt werden. Überprüfen Sie das Error-Log für weitere Informationen.', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/en.dict.combodo-workflow-graphical-view.php b/en.dict.combodo-workflow-graphical-view.php index c10fc16..77d432f 100644 --- a/en.dict.combodo-workflow-graphical-view.php +++ b/en.dict.combodo-workflow-graphical-view.php @@ -1,6 +1,6 @@ 'Show workflow', 'workflow-graphical-view:UI:Modal:Title' => 'Workflow', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state', @@ -25,4 +25,5 @@ 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible', +]); diff --git a/es_cr.dict.combodo-workflow-graphical-view.php b/es_cr.dict.combodo-workflow-graphical-view.php index c340bfb..124ea08 100644 --- a/es_cr.dict.combodo-workflow-graphical-view.php +++ b/es_cr.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); \ No newline at end of file diff --git a/fr.dict.combodo-workflow-graphical-view.php b/fr.dict.combodo-workflow-graphical-view.php index bdc90a2..d8eb3cb 100644 --- a/fr.dict.combodo-workflow-graphical-view.php +++ b/fr.dict.combodo-workflow-graphical-view.php @@ -2,15 +2,25 @@ /** * Localized data * - * @copyright Copyright (C) 2013 XXXXX - * @license http://opensource.org/licenses/AGPL-3.0 + * @copyright Copyright (C) 2010-2024 Combodo SAS + * @license https://opensource.org/licenses/AGPL-3.0 + * + */ +/** + * */ -Dict::Add('FR FR', 'French', 'Français', array( +Dict::Add('FR FR', 'French', 'Français', [ + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Oups ! Le cycle de vie n\'a pas pu être chargé, vérifiez le journal des erreurs pour plus d\'informations.', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Impossible de générer le graphique du cycle de vie pour %1$s car la classe n\'a pas d\'attribut portant le cycle de vie.', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Voir le cycle de vie', - 'workflow-graphical-view:UI:Modal:Title' => 'Cycle de vie', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'État courant', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'Transitions utilisateurs', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Transitions internes', 'workflow-graphical-view:Error:NoStateAttribute' => 'Impossible de générer le graphique du cycle de vie pour %1$s car la classe n\'a pas d\'attribut portant le cycle de vie.', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Oups ! Le cycle de vie n\'a pas pu être chargé, vérifiez le journal des erreurs pour plus d\'informations.', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Impossible d\'afficher le cycle de vie pour l\'objet %1$s#%2$s, il n\'est pas disponible.', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'Transitions utilisateurs', + 'workflow-graphical-view:UI:Modal:Title' => 'Cycle de vie', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Impossible de générer le graphique du cycle de vie pour %1$s car la classe n\'a pas d\'attribut portant le cycle de vie.', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Oups ! Le cycle de vie n\'a pas pu être chargé, vérifiez le journal des erreurs pour plus d\'informations.', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Impossible d\'afficher le cycle de vie pour l\'objet %1$s#%2$s, il n\'est pas disponible.', +]); diff --git a/hu.dict.combodo-workflow-graphical-view.php b/hu.dict.combodo-workflow-graphical-view.php index c3972f6..bffc24e 100644 --- a/hu.dict.combodo-workflow-graphical-view.php +++ b/hu.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/it.dict.combodo-workflow-graphical-view.php b/it.dict.combodo-workflow-graphical-view.php index de1fc46..e6f3df5 100644 --- a/it.dict.combodo-workflow-graphical-view.php +++ b/it.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/ja.dict.combodo-workflow-graphical-view.php b/ja.dict.combodo-workflow-graphical-view.php index 927a215..7cc0478 100644 --- a/ja.dict.combodo-workflow-graphical-view.php +++ b/ja.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/module.combodo-workflow-graphical-view.php b/module.combodo-workflow-graphical-view.php index 32a6742..4fa9b27 100644 --- a/module.combodo-workflow-graphical-view.php +++ b/module.combodo-workflow-graphical-view.php @@ -1,6 +1,6 @@ array(), + 'dependencies' => array( + //optional dependance with the portal as it can be used in the back office only + 'itop-portal-base/3.2.0 || itop-structure/3.2.0', + ), 'mandatory' => false, 'visible' => true, @@ -38,7 +41,9 @@ 'datamodel' => array( // Module's autoloader 'vendor/autoload.php', + 'src/Portal/Controller/LifecycleBrickController.php', // Explicitly load APIs classes + 'src/Portal/Router/LifecycleBrickRouter.php', 'src/Hook/ConsoleUIExtension.php', 'src/Hook/PortalUIExtension.php', ), diff --git a/nl.dict.combodo-workflow-graphical-view.php b/nl.dict.combodo-workflow-graphical-view.php index 7a77b0f..40fc85f 100644 --- a/nl.dict.combodo-workflow-graphical-view.php +++ b/nl.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/pl.dict.combodo-workflow-graphical-view.php b/pl.dict.combodo-workflow-graphical-view.php index 3c5924b..c0f9800 100644 --- a/pl.dict.combodo-workflow-graphical-view.php +++ b/pl.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/pt_br.dict.combodo-workflow-graphical-view.php b/pt_br.dict.combodo-workflow-graphical-view.php index dabb1c1..ed00b45 100644 --- a/pt_br.dict.combodo-workflow-graphical-view.php +++ b/pt_br.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/ru.dict.combodo-workflow-graphical-view.php b/ru.dict.combodo-workflow-graphical-view.php index bee3709..2c5e570 100644 --- a/ru.dict.combodo-workflow-graphical-view.php +++ b/ru.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/sk.dict.combodo-workflow-graphical-view.php b/sk.dict.combodo-workflow-graphical-view.php index 914cc01..f6f5259 100644 --- a/sk.dict.combodo-workflow-graphical-view.php +++ b/sk.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/src/Helper/ConfigHelper.php b/src/Helper/ConfigHelper.php index 1391f69..8d5227c 100644 --- a/src/Helper/ConfigHelper.php +++ b/src/Helper/ConfigHelper.php @@ -1,7 +1,7 @@ GetKey())); + } + + // Get module parameters + // - stimuli to hide + $aStimuliToHide = array(); + $aModuleParameter = ConfigHelper::GetModuleSetting('stimuli_to_hide'); + if (is_array($aModuleParameter) && isset($aModuleParameter[$sObjClass])) { + foreach (explode(',', $aModuleParameter[$sObjClass]) as $sStimulusCode) { + $aStimuliToHide[] = trim($sStimulusCode); + } + } + // - internal stimuli to hide + $bHideInternalStimuli = ConfigHelper::GetModuleSetting('hide_internal_stimuli'); + + $oLM = new LifecycleManager($oObject); + $sImageFilePath = $oLM->GetLifecycleImage($aStimuliToHide, $bHideInternalStimuli); + + $aHeaders = []; + $sFileContent = null; + // Send content + switch ($sOutputFormat) { + case 'base64': + $aHeaders['Content-type'] = 'text/plain'; + $sFileContent = base64_encode(file_get_contents($sImageFilePath)); + break; + + case 'binary': + default: + $aHeaders['Content-type'] = 'image/png'; + $sFileContent = file_get_contents($sImageFilePath); + break; + } + + + // If image in temp. dir., we delete it (means that it's not the default image) + if (stripos($sImageFilePath, GraphvizGenerator::$sTmpFolderPath) !== false) { + @unlink($sImageFilePath); + } + + return [$sFileContent, Response::HTTP_OK, $aHeaders]; + } + catch (Exception $oException) { + $aHeaders['Content-type'] = 'text/html'; + + return ["

{$oException->getMessage()}

", Response::HTTP_INTERNAL_SERVER_ERROR, $aHeaders]; + } + } +} \ No newline at end of file diff --git a/src/Hook/ConsoleUIExtension.php b/src/Hook/ConsoleUIExtension.php index fa20c34..a614414 100644 --- a/src/Hook/ConsoleUIExtension.php +++ b/src/Hook/ConsoleUIExtension.php @@ -1,7 +1,7 @@ GetJSWidgetSnippetForObjectDetails(); // Add resources - foreach($aCSSFiles as $sCSSFile) - { - $oPage->add_linked_stylesheet($sCSSFile); + foreach ($aCSSFiles as $sCSSFile) { + $oPage->LinkStylesheetFromURI($sCSSFile); } - foreach($aJSFiles as $sJSFile) - { - $oPage->add_linked_script($sJSFile); + foreach ($aJSFiles as $sJSFile) { + $oPage->LinkScriptFromURI($sJSFile); } // Add script diff --git a/src/Hook/PortalUIExtension.php b/src/Hook/PortalUIExtension.php index 672f56c..4892c17 100644 --- a/src/Hook/PortalUIExtension.php +++ b/src/Hook/PortalUIExtension.php @@ -1,6 +1,6 @@ get('router'); + $sEndpoint = $oRouter->generate('p_lifecycle_view_object'); $sDictEntryShowButtonTooltipAsJSON = json_encode(Dict::S('workflow-graphical-view:UI:Button:ShowLifecycle')); $sDictEntryModalTitleAsJSON = json_encode(Dict::S('workflow-graphical-view:UI:Modal:Title')); diff --git a/src/Portal/Controller/LifecycleBrickController.php b/src/Portal/Controller/LifecycleBrickController.php new file mode 100644 index 0000000..d6d07d0 --- /dev/null +++ b/src/Portal/Controller/LifecycleBrickController.php @@ -0,0 +1,49 @@ +oRequestManipulatorHelper->ReadParam('object_class', '', FILTER_SANITIZE_SPECIAL_CHARS); + $iObjID = (int) $this->oRequestManipulatorHelper->ReadParam('object_id', 0, FILTER_SANITIZE_NUMBER_INT); + $sOutputFormat = $this->oRequestManipulatorHelper->ReadParam('output_format', 'image', FILTER_SANITIZE_SPECIAL_CHARS); + + if ($this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sObjClass, $iObjID) === false) { + throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist')); + } + + $oObject = MetaModel::GetObject($sObjClass, $iObjID, true, true); + [$sContent, $sHttpResponseCode, $aHeaders] = LifecycleGraphHelper::GetLifecycleGraph($oObject, $sOutputFormat); + return new Response($sContent, $sHttpResponseCode, $aHeaders); + } +} diff --git a/src/Portal/Router/LifecycleBrickRouter.php b/src/Portal/Router/LifecycleBrickRouter.php new file mode 100644 index 0000000..5e1b0d3 --- /dev/null +++ b/src/Portal/Router/LifecycleBrickRouter.php @@ -0,0 +1,43 @@ + '/lifecycle/view', + 'callback' => 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Portal\\Controller\\LifecycleBrickController::ViewObjectLifecycleAction', + 'bind' => 'p_lifecycle_view_object' + ], + ] + ); +} \ No newline at end of file diff --git a/src/Service/GraphvizGenerator.php b/src/Service/GraphvizGenerator.php index 46aadce..b8a0685 100644 --- a/src/Service/GraphvizGenerator.php +++ b/src/Service/GraphvizGenerator.php @@ -1,7 +1,7 @@ $sStateAttCode); - } - foreach (MetaModel::EnumChildClasses($sRootClass) as $sChildClass) { - $sStateAttCode = MetaModel::GetStateAttributeCode($sChildClass); - if (!empty($sStateAttCode)) { - $aEligibleClasses[$sChildClass] = array('state_att_code' => $sStateAttCode); - } - } + foreach (MetaModel::EnumRootClasses() as $sRootClass) { + $sStateAttCode = MetaModel::GetStateAttributeCode($sRootClass); + if (MetaModel::HasLifecycle($sRootClass)) { + $aEligibleClasses[$sRootClass] = array('state_att_code' => $sStateAttCode); } - } else { - foreach (MetaModel::EnumRootClasses() as $sRootClass) { - $sStateAttCode = MetaModel::GetStateAttributeCode($sRootClass); - if (MetaModel::HasLifecycle($sRootClass)) { - $aEligibleClasses[$sRootClass] = array('state_att_code' => $sStateAttCode); - } - foreach (MetaModel::EnumChildClasses($sRootClass) as $sChildClass) { - $sStateAttCode = MetaModel::GetStateAttributeCode($sChildClass); - if (MetaModel::HasLifecycle($sChildClass)) { - $aEligibleClasses[$sChildClass] = array('state_att_code' => $sStateAttCode); - } + foreach (MetaModel::EnumChildClasses($sRootClass) as $sChildClass) { + $sStateAttCode = MetaModel::GetStateAttributeCode($sChildClass); + if (MetaModel::HasLifecycle($sChildClass)) { + $aEligibleClasses[$sChildClass] = array('state_att_code' => $sStateAttCode); } } } @@ -232,7 +208,7 @@ public function GetJSWidgetSnippetForObjectDetails() $sDictEntryModalTitleAsJSON = json_encode(Dict::S('workflow-graphical-view:UI:Modal:Title')); $sDictEntryModalCloseLabelAsJSON = json_encode(Dict::S('UI:Button:Close')); - $sAttributeSelectorPrefix = (version_compare(ITOP_DESIGN_LATEST_VERSION , '3.0', '>=') && ContextTag::Check(ContextTag::TAG_CONSOLE)) ? '.ibo-object-details' : '.object-details'; + $sAttributeSelectorPrefix = ContextTag::Check(ContextTag::TAG_CONSOLE) ? '.ibo-object-details' : '.object-details'; return << 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]); diff --git a/vendor/autoload.php b/vendor/autoload.php index d6b9ae5..538883d 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -2,6 +2,24 @@ // autoload.php @generated by Composer +if (PHP_VERSION_ID < 50600) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); +} + require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit8e40dbcbd20280eb1498a6aa84fb9d6f::getLoader(); diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index fce8549..7824d8f 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -37,57 +37,126 @@ * * @author Fabien Potencier * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ */ class ClassLoader { + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + // PSR-4 + /** + * @var array> + */ private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ private $prefixDirsPsr4 = array(); + /** + * @var list + */ private $fallbackDirsPsr4 = array(); // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ private $prefixesPsr0 = array(); + /** + * @var list + */ private $fallbackDirsPsr0 = array(); + /** @var bool */ private $useIncludePath = false; + + /** + * @var array + */ private $classMap = array(); + + /** @var bool */ private $classMapAuthoritative = false; + + /** + * @var array + */ private $missingClasses = array(); + + /** @var string|null */ private $apcuPrefix; + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ public function getPrefixes() { if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } return array(); } + /** + * @return array> + */ public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } + /** + * @return list + */ public function getFallbackDirs() { return $this->fallbackDirsPsr0; } + /** + * @return list + */ public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } + /** + * @return array Array of classname => path + */ public function getClassMap() { return $this->classMap; } /** - * @param array $classMap Class to filename map + * @param array $classMap Class to filename map + * + * @return void */ public function addClassMap(array $classMap) { @@ -102,22 +171,25 @@ public function addClassMap(array $classMap) * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -126,19 +198,19 @@ public function add($prefix, $paths, $prepend = false) $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -147,25 +219,28 @@ public function add($prefix, $paths, $prepend = false) * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException + * + * @return void */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -175,18 +250,18 @@ public function addPsr4($prefix, $paths, $prepend = false) throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -195,8 +270,10 @@ public function addPsr4($prefix, $paths, $prepend = false) * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void */ public function set($prefix, $paths) { @@ -211,10 +288,12 @@ public function set($prefix, $paths) * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException + * + * @return void */ public function setPsr4($prefix, $paths) { @@ -234,6 +313,8 @@ public function setPsr4($prefix, $paths) * Turns on searching the include path for class files. * * @param bool $useIncludePath + * + * @return void */ public function setUseIncludePath($useIncludePath) { @@ -256,6 +337,8 @@ public function getUseIncludePath() * that have not been registered with the class map. * * @param bool $classMapAuthoritative + * + * @return void */ public function setClassMapAuthoritative($classMapAuthoritative) { @@ -276,6 +359,8 @@ public function isClassMapAuthoritative() * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix + * + * @return void */ public function setApcuPrefix($apcuPrefix) { @@ -296,33 +381,55 @@ public function getApcuPrefix() * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } } /** * Unregisters this instance as an autoloader. + * + * @return void */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } } /** * Loads the given class or interface. * * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise + * @return true|null True if loaded, null otherwise */ public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } + + return null; } /** @@ -367,6 +474,21 @@ public function findFile($class) return $file; } + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ private function findFileWithExtension($class, $ext) { // PSR-4 lookup @@ -432,14 +554,26 @@ private function findFileWithExtension($class, $ext) return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index a001fd5..79d462d 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -2,13 +2,14 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( - 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Extension\\ConsoleUIExtension' => $baseDir . '/src/Hook/ConsoleUIExtension.php', - 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Extension\\PortalUIExtension' => $baseDir . '/src/Hook/PortalUIExtension.php', 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Helper\\ConfigHelper' => $baseDir . '/src/Helper/ConfigHelper.php', + 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Helper\\LifecycleGraphHelper' => $baseDir . '/src/Helper/LifecycleGraphHelper.php', + 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Portal\\Controller\\LifecycleBrickController' => $baseDir . '/src/Portal/Controller/LifecycleBrickController.php', 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Service\\GraphvizGenerator' => $baseDir . '/src/Service/GraphvizGenerator.php', 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Service\\LifecycleManager' => $baseDir . '/src/Service/LifecycleManager.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', ); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index b7fc012..15a2ff3 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 821da76..55868e9 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 3b6703e..5326ad8 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -13,6 +13,9 @@ public static function loadClassLoader($class) } } + /** + * @return \Composer\Autoload\ClassLoader + */ public static function getLoader() { if (null !== self::$loader) { @@ -20,20 +23,11 @@ public static function getLoader() } spl_autoload_register(array('ComposerAutoloaderInit8e40dbcbd20280eb1498a6aa84fb9d6f', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); spl_autoload_unregister(array('ComposerAutoloaderInit8e40dbcbd20280eb1498a6aa84fb9d6f', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit8e40dbcbd20280eb1498a6aa84fb9d6f::getInitializer($loader)); - } else { - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } + require __DIR__ . '/autoload_static.php'; + call_user_func(\Composer\Autoload\ComposerStaticInit8e40dbcbd20280eb1498a6aa84fb9d6f::getInitializer($loader)); $loader->setClassMapAuthoritative(true); $loader->register(true); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 385151b..4a07068 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -21,11 +21,12 @@ class ComposerStaticInit8e40dbcbd20280eb1498a6aa84fb9d6f ); public static $classMap = array ( - 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Extension\\ConsoleUIExtension' => __DIR__ . '/../..' . '/src/Hook/ConsoleUIExtension.php', - 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Extension\\PortalUIExtension' => __DIR__ . '/../..' . '/src/Hook/PortalUIExtension.php', 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Helper\\ConfigHelper' => __DIR__ . '/../..' . '/src/Helper/ConfigHelper.php', + 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Helper\\LifecycleGraphHelper' => __DIR__ . '/../..' . '/src/Helper/LifecycleGraphHelper.php', + 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Portal\\Controller\\LifecycleBrickController' => __DIR__ . '/../..' . '/src/Portal/Controller/LifecycleBrickController.php', 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Service\\GraphvizGenerator' => __DIR__ . '/../..' . '/src/Service/GraphvizGenerator.php', 'Combodo\\iTop\\Extension\\WorkflowGraphicalView\\Service\\LifecycleManager' => __DIR__ . '/../..' . '/src/Service/LifecycleManager.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', ); public static function getInitializer(ClassLoader $loader) diff --git a/zh_cn.dict.combodo-workflow-graphical-view.php b/zh_cn.dict.combodo-workflow-graphical-view.php index 6fcf1ac..b7c8342 100644 --- a/zh_cn.dict.combodo-workflow-graphical-view.php +++ b/zh_cn.dict.combodo-workflow-graphical-view.php @@ -1,27 +1,26 @@ 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:UI:Button:ShowLifecycle' => 'Show workflow~~', - 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', 'workflow-graphical-view:UI:Legend:Item:CurrentState' => 'Current state~~', - 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', 'workflow-graphical-view:UI:Legend:Item:InternalStimuli' => 'Internal stimuli~~', 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', -)); + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', + 'workflow-graphical-view:UI:Legend:Item:UserStimuli' => 'User stimuli~~', + 'workflow-graphical-view:UI:Modal:Title' => 'Workflow~~', + 'workflow-graphical-view:Error:NoStateAttribute' => 'Cannot generate lifecycle graph for %1$s as it has no state attribute.~~', + 'workflow-graphical-view:Error:GraphVizGeneration' => 'Whoops! Lifecycle could not be generated, check the error log for more information.~~', + 'workflow-graphical-view:Error:ObjectNotEligible' => 'Cannot show lifecycle for %1$s#%2$s, object is not eligible~~', +]);