瀏覽代碼

- Fixed bug Trac #60 (Modification of a Service Call does not work with IE). This was due to some forms being contained within another form (forbidden in HTML)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@216 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 15 年之前
父節點
當前提交
275b8fdfaa
共有 3 個文件被更改,包括 23 次插入6 次删除
  1. 1 0
      application/itopwebpage.class.inc.php
  2. 9 6
      application/ui.linkswidget.class.inc.php
  3. 13 0
      application/webpage.class.inc.php

+ 1 - 0
application/itopwebpage.class.inc.php

@@ -332,6 +332,7 @@ EOF
         {
             echo "<div class=\"raw_output\">$s_captured_output</div>\n";
         }
+        echo $this->s_deferred_content;
 		echo "<div class=\"jqmWindow\" id=\"ex2\">Please wait...</div>\n"; // jqModal Window
 		echo "</div> <!-- RightPane -->\n";
 		echo "</div> <!-- Splitter -->\n";

+ 9 - 6
application/ui.linkswidget.class.inc.php

@@ -78,8 +78,8 @@ class UILinksWidget
 			$sHTMLValue .= "<script type=\"text/javascript\">\n";
 			$sHTMLValue .= "oLinkWidget{$this->m_iInputId} = new LinksWidget('{$this->m_iInputId}', '$sLinkedClass', '$sExtKeyToMe', '$sExtKeyToRemote', $sAttributes);\n";
 			$sHTMLValue .= "</script>\n";
-			$sHTMLValue .= $this->GetObjectPickerDialog($oPage, $sTargetClass, 'oLinkWidget'.$this->m_iInputId.'.OnOk');
-			$sHTMLValue .= $this->GetLinkObjectDialog($oPage, $this->m_iInputId);
+			$oPage->add_at_the_end($this->GetObjectPickerDialog($oPage, $sTargetClass, 'oLinkWidget'.$this->m_iInputId.'.OnOk')); // Forms should not be inside forms
+			$oPage->add_at_the_end($this->GetLinkObjectDialog($oPage, $this->m_iInputId)); // Forms should not be inside forms
 			$sHTMLValue .= "<input type=\"text\" id=\"ac_{$this->m_iInputId}\" size=\"35\" value=\"\" title=\"Type the first 3 characters\"/>";
 			$sHTMLValue .= "<input type=\"button\" id=\"ac_add_{$this->m_iInputId}\" value=\" Add... \"  class=\"action\" onClick=\"oLinkWidget{$this->m_iInputId}.AddObject();\"/>";
 			$sHTMLValue .= "&nbsp;<input type=\"button\" value=\"Browse...\"  class=\"action\" onClick=\"return ManageObjects('$sTitle', '$sTargetClass', '$this->m_iInputId', '$sExtKeyToRemote');\"/>";
@@ -94,10 +94,13 @@ class UILinksWidget
 		{
 			// Few choices, use a normal 'select'
 			$sHTMLValue = "<select name=\"attr_{$this->m_sAttCode}\"  id=\"{$this->m_iInputId}\">\n";
-			
-			foreach($aAllowedValues as $key => $value)
+			$sHTMLValue .= "<option value=\"0\">--- select a value ---</option>\n";
+			if (count($aAllowedValues) > 0)
 			{
-				$sHTMLValue .= "<option value=\"$key\"$sSelected>$value</option>\n";
+				foreach($aAllowedValues as $key => $value)
+				{
+					$sHTMLValue .= "<option value=\"$key\"$sSelected>$value</option>\n";
+				}
 			}
 			$sHTMLValue .= "</select>\n";
 		}
@@ -274,7 +277,7 @@ EOF;
 		
 		$sHTML = "<div class=\"jqmWindow\" id=\"LinkDlg_$sId\">\n";
 		$sHTML .= "<div class=\"wizContainer\">\n";
-		$sHTML .= "<div class=\"page_header\"><h1 id=\"LinkObject_DlgTitle\">".MetaModel::GetName($sLinkedClass)." attributes</h1></div>\n";
+		$sHTML .= "<div class=\"page_header\"><h1>".MetaModel::GetName($sLinkedClass)." attributes</h1></div>\n";
 		$sHTML .= "<form action=\"./UI.php\" onSubmit=\"return oLinkWidget$sId.OnLinkOk();\">\n";
 		$index = 0;
 		$aAttrsMap = array();

+ 13 - 0
application/webpage.class.inc.php

@@ -14,6 +14,7 @@ class web_page
 {
     protected $s_title;
     protected $s_content;
+    protected $s_deferred_content;
     protected $a_scripts;
     protected $a_styles;
     protected $a_include_scripts;
@@ -25,6 +26,7 @@ class web_page
     {
         $this->s_title = $s_title;
         $this->s_content = "";
+        $this->s_deferred_content = '';
         $this->a_scripts = array();
         $this->a_styles = array();
         $this->a_linked_scripts = array();
@@ -60,6 +62,16 @@ class web_page
     }
     
 	/**
+	 * Add any text or HTML fragment at the end of the body of the page
+	 * This is useful to add hidden content, DIVs or FORMs that should not
+	 * be embedded into each other.	 	 
+	 */
+    public function add_at_the_end($s_html)
+    {
+        $this->s_deferred_content .= $s_html;
+    }
+    
+	/**
 	 * Add a paragraph to the body of the page
 	 */
     public function p($s_html)
@@ -281,6 +293,7 @@ class web_page
         {
             echo "<div class=\"raw_output\">$s_captured_output</div>\n";
         }
+        echo $this->s_deferred_content;
         echo "</body>\n";
         echo "</html>\n";
     }