diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 09075f439..10374b656 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -95,6 +95,8 @@ class UIExtKeyWidget public function Display(WebPage $oPage, $aArgs = array()) { $bCreate = (UserRights::IsActionAllowed($this->sTargetClass, UR_ACTION_BULK_MODIFY) && $this->oAttDef->AllowTargetCreation()); + $sMessage = Dict::S('UI:Message:EmptyList:UseSearchForm'); + $sHTMLValue = ""; // no wrap if (count($this->aAllowedValues) < $this->oAttDef->GetMaximumComboLength()) { @@ -120,6 +122,13 @@ class UIExtKeyWidget $sHTMLValue .= "\n"; } $sHTMLValue .= "\n"; + $oPage->add_ready_script( +<<iId} = new ExtKeyWidget('{$this->iId}', '{$this->sClass}', '{$this->sAttCode}', '{$this->sNameSuffix}', $sSelectMode, oWizardHelper{$this->sFormPrefix}); + oACWidget_{$this->iId}.emptyHtml = "

$sMessage

"; + +EOF +); } else { @@ -146,10 +155,17 @@ class UIExtKeyWidget $sHTMLValue .= "iId\" name=\"attr_{$this->sFieldPrefix}{$this->sAttCode}{$this->sNameSuffix}\" value=\"$this->value\" />\n"; // Scripts to start the autocomplete and bind some events to it - $oPage->add_ready_script("\$('#label_$this->iId').autocomplete('./ajax.render.php', { scroll:true, minChars:{$iMinChars}, formatItem:formatItem, autoFill:false, matchContains:true, keyHolder:'#{$this->iId}', extraParams:{operation:'autocomplete', sclass:'$this->sClass',attCode:'".$this->sAttCode."'}});"); - $oPage->add_ready_script("\$('#label_$this->iId').blur(function() { $(this).search(); } );"); - $oPage->add_ready_script("\$('#label_$this->iId').result( function(event, data, formatted) { OnAutoComplete('$this->iId', event, data, formatted); } );"); - $oPage->add_ready_script("\$('#ac_dlg_$this->iId').dialog({ width: $(window).width()*0.8, height: $(window).height()*0.8, autoOpen: false, modal: true, title: '$this->sTitle', resizeStop: oACWidget_{$this->iId}.UpdateSizes, close: oACWidget_{$this->iId}.OnClose });\n"); + $oPage->add_ready_script( +<<iId} = new ExtKeyWidget('{$this->iId}', '{$this->sClass}', '{$this->sAttCode}', '{$this->sNameSuffix}', $sSelectMode, oWizardHelper{$this->sFormPrefix}); + oACWidget_{$this->iId}.emptyHtml = "

$sMessage

"; + $('#label_$this->iId').autocomplete('./ajax.render.php', { scroll:true, minChars:{$iMinChars}, formatItem:formatItem, autoFill:false, matchContains:true, keyHolder:'#{$this->iId}', extraParams:{operation:'autocomplete', sclass:'{$this->sClass}',attCode:'{$this->sAttCode}'}}); + $('#label_$this->iId').blur(function() { $(this).search(); } ); + $('#label_$this->iId').result( function(event, data, formatted) { OnAutoComplete('{$this->iId}', event, data, formatted); } ); + $('#ac_dlg_$this->iId').dialog({ width: $(window).width()*0.8, height: $(window).height()*0.8, autoOpen: false, modal: true, title: '{$this->sTitle}', resizeStop: oACWidget_{$this->iId}.UpdateSizes, close: oACWidget_{$this->iId}.OnClose }); + +EOF +); $oPage->add_at_the_end($this->GetSearchDialog($oPage)); // To prevent adding forms inside the main form } @@ -158,15 +174,8 @@ class UIExtKeyWidget $sHTMLValue .= "iId}.CreateObject();\"> "; $oPage->add_at_the_end('
'); } - $sMessage = Dict::S('UI:Message:EmptyList:UseSearchForm'); $sHTMLValue .= "iId}\">"; $sHTMLValue .= "
"; // end of no wrap - $oPage->add_ready_script( -<<iId} = new ExtKeyWidget('$this->iId', '$this->sClass', '$this->sAttCode', '$this->sNameSuffix', $sSelectMode, oWizardHelper{$this->sFormPrefix}); - oACWidget_{$this->iId}.emptyHtml = "

$sMessage

"; -EOF -); return $sHTMLValue; }