소스 검색

Debug of the ExtKeyWidget...

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@996 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 년 전
부모
커밋
bf9b968798
1개의 변경된 파일20개의 추가작업 그리고 11개의 파일을 삭제
  1. 20 11
      application/ui.extkeywidget.class.inc.php

+ 20 - 11
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 = "<span style=\"white-space:nowrap\">"; // no wrap
 		if (count($this->aAllowedValues) < $this->oAttDef->GetMaximumComboLength())
 		{
@@ -120,6 +122,13 @@ class UIExtKeyWidget
 				$sHTMLValue .= "<option value=\"$key\"$sSelected>$display_value</option>\n";
 			}
 			$sHTMLValue .= "</select>\n";
+		$oPage->add_ready_script(
+<<<EOF
+		oACWidget_{$this->iId} = new ExtKeyWidget('{$this->iId}', '{$this->sClass}', '{$this->sAttCode}', '{$this->sNameSuffix}', $sSelectMode, oWizardHelper{$this->sFormPrefix});
+		oACWidget_{$this->iId}.emptyHtml = "<div style=\"background: #fff; border:0; text-align:center; vertical-align:middle;\"><p>$sMessage</p></div>";
+
+EOF
+);
 		}
 		else
 		{
@@ -146,10 +155,17 @@ class UIExtKeyWidget
 			$sHTMLValue .= "<input type=\"hidden\" id=\"$this->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(
+<<<EOF
+		oACWidget_{$this->iId} = new ExtKeyWidget('{$this->iId}', '{$this->sClass}', '{$this->sAttCode}', '{$this->sNameSuffix}', $sSelectMode, oWizardHelper{$this->sFormPrefix});
+		oACWidget_{$this->iId}.emptyHtml = "<div style=\"background: #fff; border:0; text-align:center; vertical-align:middle;\"><p>$sMessage</p></div>";
+		$('#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 .= "<a class=\"no-arrow\" href=\"javascript:oACWidget_{$this->iId}.CreateObject();\"><img style=\"border:0;vertical-align:middle;\" src=\"../images/mini_add.gif\" /></a>&nbsp;";
 			$oPage->add_at_the_end('<div id="ajax_'.$this->iId.'"></div>');
 		}
-		$sMessage = Dict::S('UI:Message:EmptyList:UseSearchForm');
 		$sHTMLValue .= "<span id=\"v_{$this->iId}\"></span>";
 		$sHTMLValue .= "</span>"; // end of no wrap
-		$oPage->add_ready_script(
-<<<EOF
-		oACWidget_{$this->iId} = new ExtKeyWidget('$this->iId', '$this->sClass', '$this->sAttCode', '$this->sNameSuffix', $sSelectMode, oWizardHelper{$this->sFormPrefix});
-		oACWidget_{$this->iId}.emptyHtml = "<div style=\"background: #fff; border:0; text-align:center; vertical-align:middle;\"><p>$sMessage</p></div>";
-EOF
-);
 		return $sHTMLValue;
 	}