N°1401 - External dashlet edition in the designer

SVN:trunk[5914]
This commit is contained in:
Eric Espié
2018-06-27 13:58:36 +00:00
parent e97e9907c7
commit 242caff990

View File

@@ -290,7 +290,7 @@ EOF
);
}
public function GetForm()
public function GetForm($aInfo = array())
{
$oForm = new DesignerForm();
$sPrefix = "dashlet_".$this->GetID();
@@ -424,6 +424,28 @@ class DashletUnknown extends Dashlet
$this->OnUpdate();
}
/**
* @param $oDOMNode
*
* @throws \DOMFormatException
*/
public function ToDOMNode($oDOMNode)
{
$oDoc = new DOMDocument();
libxml_clear_errors();
$oDoc->loadXML('<root>'.$this->sOriginalDashletXML.'</root>');
$aErrors = libxml_get_errors();
if (count($aErrors) > 0)
{
throw new DOMFormatException('Dashlet definition not correctly formatted!');
}
foreach($oDoc->documentElement->childNodes as $oDOMChildNode)
{
$oPropNode = $oDOMNode->ownerDocument->importNode($oDOMChildNode, true);
$oDOMNode->appendChild($oPropNode);
}
}
public function FromParams($aParams)
{
// For unknown dashlet, parameters are not parsed but passed as a raw xml
@@ -466,6 +488,15 @@ class DashletUnknown extends Dashlet
$oPage->add('</div>');
}
public function GetForm($aInfo = array())
{
if (isset($aInfo['configuration']) && empty($this->sOriginalDashletXML))
{
$this->sOriginalDashletXML = $aInfo['configuration'];
}
return parent::GetForm($aInfo);
}
public function GetPropertiesFields(DesignerForm $oForm)
{
$oField = new DesignerLongTextField('xml', Dict::S('UI:DashletUnknown:Prop-XMLConfiguration'), $this->sOriginalDashletXML);