Files
iTop/sources/Application/UI/Links/Indirect/BlockObjectPickerDialog.php
bdalsass bdb29fd99a Issue/5074 - Routage, Block UI relations, Links row actions (#369)
* datatable row actions

Below is a sample of extra param to enable feature:

		$aExtraParams['row_actions'] = [
			[
				'tooltip'        => 'remove an element',
				'icon_css_class' => 'fa-minus',
				'js_row_action'   => 'console.log("You clicked the remove button");',
				'confirmation'  => [
					'message'                  => 'UI:ConfirmationMessage',
					'message_row_data'         => "name",
					'remember_choice_pref_key' => 'remove_do_not_show_again',
				],
			],
			[
				'tooltip'        => 'open in new tab',
				'icon_css_class' => 'fa-external-link-square-alt',
				'on_action_js'   => 'window.open("http://localhost/itop-branchs/dev/pages/UI.php?operation=details&class=UserRequest&id=" + aData.id + "&c[menu]=UserRequest%3AOpenRequests");',
			],
			[
				'tooltip'        => 'other actions',
				'icon_css_class' => 'fa-ellipsis-v',
				'on_action_js'   => 'console.log(event);',
			],
		];

* Contrôleur pour la suppression et le détachement de liens
* Block UI pour l'édition des relations
* Block UI pour la visualisation des relations
* Boutons d'actions pour la suppression et le détachement de liens
* Gestion dialogue de confirmation pour les row actions
2022-11-23 16:10:34 +01:00

57 lines
1.7 KiB
PHP

<?php
/**
* @copyright Copyright (C) 2010-2021 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Application\UI\Links\Indirect;
use Combodo\iTop\Application\UI\Base\Component\Form\Form;
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
use Dict;
/**
* Class BlockObjectPickerDialog
*
* @internal
* @package Combodo\iTop\Application\UI\Links\Indirect
*/
class BlockObjectPickerDialog extends UIContentBlock
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-block-object-picker-dialog';
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'application/links/indirect/block-object-picker-dialog/layout';
/** @var \UILinksWidget */
public \UILinksWidget $oUILinksWidget;
/**
* Constructor.
*
* @param \UILinksWidget $oUILinksWidget
*/
public function __construct(\UILinksWidget $oUILinksWidget)
{
parent::__construct();
// Retrieve parameters
$this->oUILinksWidget = $oUILinksWidget;
}
public function AddForm()
{
$sEmptyList = Dict::S('UI:Message:EmptyList:UseSearchForm');
$sCancel = Dict::S('UI:Button:Cancel');
$sAdd = Dict::S('UI:Button:Add');
$oForm = new Form("ObjectsAddForm_{$this->oUILinksWidget->GetLinkedSetId()}");
$this->AddSubBlock($oForm);
$oBlock = new UIContentBlock("SearchResultsToAdd_{$this->oUILinksWidget->GetLinkedSetId()}", ['ibo-block-object-picker-dialog--results']);
$oForm->AddSubBlock($oBlock);
$oBlock->AddHtml("<p>{$sEmptyList}</p>");
$oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden("count_{$this->oUILinksWidget->GetLinkedSetId()}", '0', "count_{$this->oUILinksWidget->GetLinkedSetId()}"));
}
}