mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 07:42:17 +02:00
Merge remote-tracking branch 'origin/support/3.2' into develop
# Conflicts: # core/kpi.class.inc.php # datamodels/2.x/itop-profiles-itil/datamodel.itop-profiles-itil.xml
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
namespace Combodo\iTop\Portal\Brick;
|
||||
|
||||
use Combodo\iTop\DesignElement;
|
||||
use Combodo\iTop\Portal\Service\TemplatesProvider\TemplateDefinitionDto;
|
||||
use Combodo\iTop\Portal\Service\TemplatesProvider\TemplatesRegister;
|
||||
use DOMFormatException;
|
||||
|
||||
/**
|
||||
@@ -46,6 +48,17 @@ class CreateBrick extends PortalBrick
|
||||
/** @var array $aRules */
|
||||
protected $aRules;
|
||||
|
||||
const DEFAULT_PAGE_TEMPLATE_PATH = 'itop-portal-base/portal/templates/bricks/create/modal.html.twig';
|
||||
|
||||
/** @inheritdoc */
|
||||
public static function RegisterTemplates(TemplatesRegister $oTemplatesRegister): void
|
||||
{
|
||||
parent::RegisterTemplates($oTemplatesRegister);
|
||||
$oTemplatesRegister->RegisterTemplates(self::class,
|
||||
TemplateDefinitionDto::Create('page', static::TEMPLATES_BASE_PATH . 'create/modal.html.twig')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
@@ -359,7 +359,8 @@ class ObjectFormManager extends FormManager
|
||||
foreach ($this->aFieldsAtts as $sAttCode => $iFieldFlags)
|
||||
{
|
||||
// handle plugins fields
|
||||
if(array_key_exists($sAttCode, $this->aExtraData)
|
||||
if($this->sMode !== 'apply_stimulus'
|
||||
&& array_key_exists($sAttCode, $this->aExtraData)
|
||||
&& array_key_exists('plugin', $this->aExtraData[$sAttCode])){
|
||||
$sPluginName = $this->aExtraData[$sAttCode]['plugin'];
|
||||
switch($sPluginName){
|
||||
@@ -713,7 +714,8 @@ class ObjectFormManager extends FormManager
|
||||
|
||||
// fallback Checking if the instance has attachments
|
||||
// (in case attachment is not explicitly declared in layout)
|
||||
if (class_exists('Attachment') && class_exists('AttachmentPlugIn')
|
||||
if ($this->sMode !== 'apply_stimulus'
|
||||
&& class_exists('Attachment') && class_exists('AttachmentPlugIn')
|
||||
&& !$this->IsPluginInitialized(AttachmentPlugIn::class)
|
||||
&& AttachmentPlugIn::IsAttachmentAllowedForObject($this->oObject)){
|
||||
$this->AddAttachmentField($this->oForm, 'attachments_plugin', $this->aExtraData);
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{# itop-portal-base/portal/templates/bricks/create/layout.html.twig #}
|
||||
{# Create brick base layout #}
|
||||
{% extends 'itop-portal-base/portal/templates/modal/layout.html.twig' %}
|
||||
|
||||
{% block pModalTitle %}
|
||||
{{ sPageTitle|dict_s }}
|
||||
{% endblock %}
|
||||
|
||||
{% block pModalBody %}
|
||||
<p>{{ 'Brick:Portal:Create:ChooseType'|dict_s }}</p>
|
||||
<ul id="{{ sLeafClassesListId }}">
|
||||
{% for aLeafClass in aLeafClasses %}
|
||||
<li><a href="#" data-target-class="{{ aLeafClass.id }}">{{ aLeafClass.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#{{ sLeafClassesListId }} a').off('click').on('click', function(oEvent){
|
||||
oEvent.preventDefault();
|
||||
|
||||
// Preparing target class url
|
||||
var sUrl = '{{ app['url_generator'].generate('p_object_create', {sObjectClass : '-sObjectClass-'})|raw }}';
|
||||
sUrl = sUrl.replace(/-sObjectClass-/, $(this).attr('data-target-class') );
|
||||
sUrl = CombodoGlobalToolbox.AddParameterToUrl(sUrl, 'ar_token', '{{ ar_token }}');
|
||||
|
||||
// Creating a new modal
|
||||
CombodoModal.OpenModal({
|
||||
base_modal: {
|
||||
usage: 'replace',
|
||||
selector: $(this).closest('.modal'),
|
||||
},
|
||||
content: {
|
||||
endpoint: sUrl,
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block pModalFooter %}
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ 'Portal:Button:Cancel'|dict_s }}</button>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user