stable
Clone or download
This commit showcases the usage of PHP code instead of XML file to define the structure of the tracker inside the "Issue tracking" project template. The intent is to increase readability and maintenance of templates. We make the assumption that "errors" introduced in the past in XML templates will be more easily spotted via PHP code. For example in the following code, we can see that there is an "issue" with permissions (no need to define update permission on project members if registered can update) ```php (XMLSelectBoxField::fromTrackerAndName($tracker, 'status')) ->withLabel('Status') ->withRank(0) ->withPermissions( new ReadPermission('UGROUP_ANONYMOUS'), new UpdatePermission('UGROUP_REGISTERED'), new SubmitPermission('UGROUP_REGISTERED'), new UpdatePermission('UGROUP_PROJECT_MEMBERS') ) ``` compared to: ```xml … <permission scope="field" REF="F13609" ugroup="UGROUP_REGISTERED" type="PLUGIN_TRACKER_FIELD_SUBMIT"/> <permission scope="field" REF="F13609" ugroup="UGROUP_REGISTERED" type="PLUGIN_TRACKER_FIELD_UPDATE"/> <permission scope="field" REF="F13617" ugroup="UGROUP_ANONYMOUS" type="PLUGIN_TRACKER_FIELD_READ"/> <permission scope="field" REF="F13617" ugroup="UGROUP_REGISTERED" type="PLUGIN_TRACKER_FIELD_UPDATE"/> <permission scope="field" REF="F13617" ugroup="UGROUP_REGISTERED" type="PLUGIN_TRACKER_FIELD_SUBMIT"/> <permission scope="field" REF="F13617" ugroup="UGROUP_PROJECT_MEMBERS" type="PLUGIN_TRACKER_FIELD_UPDATE"/> <permission scope="field" REF="F13618" ugroup="UGROUP_ANONYMOUS" type="PLUGIN_TRACKER_FIELD_READ"/> <permission scope="field" REF="F13618" ugroup="UGROUP_REGISTERED" type="PLUGIN_TRACKER_FIELD_SUBMIT"/> … ``` Note: since the intent of the commit is to introduce PHP code and not to adjust the template, PHP code might still contains such weird behavior. Old (XML) tracker definition: * tools/utils/setup_templates/issues/issue_template.xml New (PHP) tracker definition, thanks to a dedicated tool to help the conversion[0]: * plugins/tracker/include/Tracker/Template/IssuesTemplate.php * plugins/cardwall/include/XML/Template/ComplementIssuesTemplate.php * plugins/graphontrackersv5/include/XML/Template/ComplementIssuesTemplate.php The drawback of the current proposal is that definition of the template is now split accross multiple files (so that plugins do not leak in each others). However it will be easier now to find usage of fields via their constants (as shown in this commit with STATUS_FIELD_ID). For now only the tracker is converted. Dashboards will be done in a dedicated contribution. Suggested entry point of the contribution: \Tuleap\Project\Registration\Template\IssuesTemplate::getXMLPath() An "Issue tracking" project created with this contribution should have nearly the same structure than one created before. The only difference is the definition of the Workflow. Since it is marked as unused, the definitions of transitions and states have been omitted here. Jira import should not suffer any functional changes (we reused and complemented code to generate XML). Part of request #22651: Convert Issue XML template to PHP code [0]: See https://gerrit.tuleap.net/c/tuleap/+/23751 Change-Id: Ie952a4dd98ebd433956632fc1b47c37e097936ff
Modified Files
Name | ||||
---|---|---|---|---|
A | plugins/cardwall/include/XML/Template/CompleteIssuesTemplate.php | +52 | −0 | Go to diff View file |
A | plugins/cardwall/include/XML/XMLCardwallRenderer.php | +59 | −0 | Go to diff View file |
M | plugins/cardwall/include/cardwallPlugin.php | +11 | −1 | Go to diff View file |
A | plugins/graphontrackersv5/include/XML/Template/CompleteIssuesTemplate.php | +102 | −0 | Go to diff View file |
A | plugins/graphontrackersv5/include/XML/XMLBarChart.php | +76 | −0 | Go to diff View file |
A | plugins/graphontrackersv5/include/XML/XMLChart.php | +86 | −0 | Go to diff View file |
A | plugins/graphontrackersv5/include/XML/XMLGraphOnTrackerRenderer.php | +62 | −0 | Go to diff View file |
A | plugins/graphontrackersv5/include/XML/XMLPieChart.php | +59 | −0 | Go to diff View file |
M | plugins/graphontrackersv5/include/graphontrackersv5Plugin.php | +11 | −1 | Go to diff View file |
M | plugins/tracker/include/Tracker/Creation/JiraImporter/Import/Structure/JiraToTuleapFieldTypeMapper.php | +1 | −1 | Go to diff View file |
M | plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/BindStatic/XML/XMLBindStaticValue.php | +76 | −3 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/BindUsers/XML/XMLBindUsersValue.php | +42 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/XML/XMLBindValue.php | +28 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/FormElement/Field/ListFields/XML/XMLDecorator.php | +46 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/FormElement/Field/ListFields/XML/XMLListField.php | +4 | −3 | Go to diff View file |
M | plugins/tracker/include/Tracker/FormElement/Field/ListFields/XML/XMLSelectBoxField.php | +0 | −1 | Go to diff View file |
M | plugins/tracker/include/Tracker/FormElement/Field/Text/XML/XMLTextField.php | +36 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/Report/Renderer/Table/XML/XMLTable.php | +2 | −3 | Go to diff View file |
M | plugins/tracker/include/Tracker/Report/Renderer/XML/XMLRenderer.php | +40 | −8 | Go to diff View file |
M | plugins/tracker/include/Tracker/Report/XML/XMLReport.php | +47 | −19 | Go to diff View file |
M | plugins/tracker/include/Tracker/Report/XML/XMLReportCriterion.php | +34 | −2 | Go to diff View file |
A | plugins/tracker/include/Tracker/Semantic/Contributor/XML/XMLContributorSemantic.php | +53 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/Semantic/Description/XML/XMLDescriptionSemantic.php | +54 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/Semantic/Status/Done/XML/XMLDoneSemantic.php | +4 | −3 | Go to diff View file |
M | plugins/tracker/include/Tracker/Semantic/Status/XML/XMLStatusSemantic.php | +10 | −10 | Go to diff View file |
M | plugins/tracker/include/Tracker/Semantic/Timeframe/XML/XMLTimeframeSemantic.php | +10 | −15 | Go to diff View file |
M | plugins/tracker/include/Tracker/Semantic/Title/XML/XMLTitleSemantic.php | +8 | −11 | Go to diff View file |
M | plugins/tracker/include/Tracker/Semantic/Tracker_SemanticFactory.class.php | +1 | −1 | Go to diff View file |
A | plugins/tracker/include/Tracker/Semantic/XML/XMLFieldsBasedSemantic.php | +58 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/Semantic/XML/XMLSemantic.php | +6 | −9 | Go to diff View file |
A | plugins/tracker/include/Tracker/Template/CompleteIssuesTemplateEvent.php | +83 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/Template/IssuesTemplate.php | +517 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/Tooltip/Tracker_Tooltip.class.php | +2 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/Workflow/XML/XMLSimpleWorkflow.php | +73 | −0 | Go to diff View file |
A | plugins/tracker/include/Tracker/Workflow/XML/XMLWorkflow.php | +33 | −0 | Go to diff View file |
M | plugins/tracker/include/Tracker/XML/XMLTracker.php | +22 | −14 | Go to diff View file |
M | plugins/tracker/include/trackerPlugin.php | +7 | −0 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/_fixtures/IE/tracker.xml | +2 | −0 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/_fixtures/IXMC/tracker.xml | +1 | −0 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/_fixtures/SBX/tracker.xml | +9 | −0 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/Creation/JiraImporter/Import/_fixtures/SP/tracker.xml | +1 | −0 | Go to diff View file |
A | plugins/tracker/tests/unit/Tracker/FormElement/Field/ListFields/Bind/BindStatic/XML/XMLBindStaticValueTest.php | +170 | −0 | Go to diff View file |
M | plugins/tracker/tests/unit/Tracker/FormElement/Field/ListFields/XML/XMLSelectBoxFieldTest.php | +49 | −1 | Go to diff View file |
A | plugins/tracker/tests/unit/Tracker/FormElement/Field/Text/XML/XMLTextFieldTest.php | +40 | −0 | Go to diff View file |
M | plugins/velocity/include/Velocity/Semantic/XML/XMLVelocitySemantic.php | +8 | −11 | Go to diff View file |
R | plugins/tracker/include/Tracker/FormElement/Field/ListFields/Bind/BindStatic/XML/XMLBindUsersValue.php | Go to diff View file | ||
M | src/common/Project/Registration/Template/IssuesTemplate.php | +24 | −7 | Go to diff View file |
M | src/common/Project/Registration/Template/TemplateFactory.php | +1 | −1 | Go to diff View file |
M | tools/utils/setup_templates/issues/issue_template.xml | +6 | −680 | Go to diff View file |