Selaa lähdekoodia

- Fixed the support of Internet Explorer (tested on IE7 and IE8)
- Cleanup of the generated HTML to have page that are XHTML compliant (not yet complete)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@198 a333f486-631f-4898-b8df-5754b55c2be0

dflaven 15 vuotta sitten
vanhempi
commit
44f141aa02

+ 5 - 5
application/cmdbabstract.class.inc.php

@@ -587,12 +587,12 @@ abstract class cmdbAbstractObject extends CMDBObject
 		$sHtml .= "</select>&nbsp;</td><td>\n";
 		$sHtml .= "<textarea name=\"oql_clause\" style=\"width:100%\">$sOQLClause</textarea></td></tr>\n";
 		$sHtml .= "<tr><td colspan=\"2\" style=\"text-align:right\"><input type=\"submit\" value=\" Query \"></td></tr>\n";
-		$sHtml .= "<input type=\"hidden\" name=\"dosearch\" value=\"1\">\n";
+		$sHtml .= "<input type=\"hidden\" name=\"dosearch\" value=\"1\" />\n";
 		foreach($aExtraParams as $sName => $sValue)
 		{
-			$sHtml .= "<input type=\"hidden\" name=\"$sName\" value=\"$sValue\">\n";
+			$sHtml .= "<input type=\"hidden\" name=\"$sName\" value=\"$sValue\" />\n";
 		}
-		$sHtml .= "<input type=\"hidden\" name=\"operation\" value=\"search_form\">\n";
+		$sHtml .= "<input type=\"hidden\" name=\"operation\" value=\"search_form\" />\n";
 		$sHtml .= "</table></form>\n";
 		$sHtml .= "</div><!-- OQL query form -->\n";
 		return $sHtml;
@@ -654,7 +654,7 @@ abstract class cmdbAbstractObject extends CMDBObject
 						{
 							// too many choices, use an autocomplete
 							// The input for the auto complete
-							$sHTMLValue = "<input count=\"".count($aAllowedValues)."\" type=\"text\" id=\"label_$iInputId\" size=\"30\" name=\"\" value=\"$sDisplayValue\"{$sCSSClasses}/>";
+							$sHTMLValue = "<input count=\"".count($aAllowedValues)."\" type=\"text\" id=\"label_$iInputId\" size=\"30\" value=\"$sDisplayValue\"{$sCSSClasses}/>";
 							// another hidden input to store & pass the object's Id
 							$sHTMLValue .= "<input type=\"hidden\" id=\"$iInputId\" name=\"attr_{$sAttCode}{$sNameSuffix}\" value=\"$value\" />\n";
 							$oPage->add_ready_script("\$('#label_$iInputId').autocomplete('./ajax.render.php', { minChars:3, onItemSelect:selectItem, onFindValue:findValue, formatItem:formatItem, autoFill:true, keyHolder:'#$iInputId', extraParams:{operation:'autocomplete', sclass:'$sClass',attCode:'".$sAttCode."'}});");
@@ -675,7 +675,7 @@ abstract class cmdbAbstractObject extends CMDBObject
 					}
 					else
 					{
-						$sHTMLValue = "<input type=\"text\" size=\"30\" name=\"attr_{$sAttCode}{$sNameSuffix}\" value=\"$value\" id=\"$iInputId\"{$sCSSClasses}>";
+						$sHTMLValue = "<input type=\"text\" size=\"30\" name=\"attr_{$sAttCode}{$sNameSuffix}\" value=\"$value\" id=\"$iInputId\"{$sCSSClasses} />";
 					}
 					break;
 			}

+ 7 - 7
application/itopwebpage.class.inc.php

@@ -134,7 +134,7 @@ EOF
     {
         // Combo box to select the organization
 		$this->AddToMenu("<div id=\"OrganizationSelection\">
-			  <form style=\"display:inline\"><select style=\"width:150px;font-size:x-small\" name=\"org_id\" \"title=\"Pick an organization\" onChange=\"this.form.submit();\">\n");
+			  <form style=\"display:inline\" action=\"./UI.php\"><select style=\"width:150px;font-size:x-small\" name=\"org_id\" title=\"Pick an organization\" onChange=\"this.form.submit();\">\n");
 		// List of visible Organizations
 		$oContext = new UserContext();
 		$oSearchFilter = $oContext->NewFilter("bizOrganization");
@@ -255,7 +255,7 @@ EOF
             }
             echo "</style>\n";
         }
-		echo "<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"iTop\" href=\"./opensearch.xml.php\">\n";
+		echo "<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"iTop\" href=\"./opensearch.xml.php\" />\n";
         echo "</head>\n";
         echo "<body>\n";
 
@@ -275,13 +275,13 @@ EOF
 		}
 		$sUserName = UserRights::GetUser();
 		$sIsAdmin = UserRights::IsAdministrator() ? '(Administrator)' : '';
-		echo "<div id=\"OrganizationSelection\" style=\"position:absolute; top:18px; right:16px; width:500px;\">Logged in as '$sUserName'&nbsp;$sIsAdmin&nbsp;&nbsp;";
+		echo "<div id=\"Login\" style=\"position:absolute; top:18px; right:16px; width:500px;\">Logged in as '$sUserName'&nbsp;$sIsAdmin&nbsp;&nbsp;";
 		echo "<form action=\"../pages/UI.php\" method=\"post\" style=\"display:inline\">\n";
-		echo "<input type=\"Submit\" value=\"Log off\">\n";
-		echo "<input type=\"hidden\" name=\"operation\" value=\"logoff\">\n";
+		echo "<input type=\"submit\" value=\"Log off\" />\n";
+		echo "<input type=\"hidden\" name=\"operation\" value=\"logoff\" />\n";
 		echo "</form>\n";
-		echo "<form action=\"../pages/UI.php\" style=\"display:inline\"><div style=\"padding:1px; background-color:#fff;display:inline;\"><img src=\"../images/magnifier.gif\"/><input style=\"border:0\" type=\"text\" size=\"15\" title=\"Global Search\" name=\"text\" value=\"$sText\"$sOnClick></input></div><input type=\"Submit\" value=\"Search\">
-			  <input type=\"hidden\" name=\"operation\" value=\"full_text\"></form>\n";
+		echo "<form action=\"../pages/UI.php\" style=\"display:inline\"><div style=\"padding:1px; background-color:#fff;display:inline;\"><img src=\"../images/magnifier.gif\"/><input style=\"border:0\" type=\"text\" size=\"15\" title=\"Global Search\" name=\"text\" value=\"$sText\"$sOnClick></input></div><input type=\"submit\" value=\"Search\" />
+			  <input type=\"hidden\" name=\"operation\" value=\"full_text\" /></form>\n";
 		echo "</div>\n";
 
 		echo "</div>\n";

+ 2 - 2
application/ui.linkswidget.class.inc.php

@@ -80,7 +80,7 @@ class UILinksWidget
 			$sHTMLValue .= "</script>\n";
 			$sHTMLValue .= $this->GetObjectPickerDialog($oPage, $sTargetClass, 'oLinkWidget'.$this->m_iInputId.'.OnOk');
 			$sHTMLValue .= $this->GetLinkObjectDialog($oPage, $this->m_iInputId);
-			$sHTMLValue .= "<input type=\"text\" id=\"ac_{$this->m_iInputId}\" size=\"35\" name=\"\" value=\"\" title=\"Type the first 3 characters\"/>";
+			$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');\"/>";
 			// another hidden input to store & pass the object's Id
@@ -275,7 +275,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 .= "<form>\n";
+		$sHTML .= "<form action=\"./UI.php\" onSubmit=\"return oLinkWidget$sId.OnLinkOk();\">\n";
 		$index = 0;
 		$aAttrsMap = array();
 		$aDetails = array();

+ 3 - 1
application/uilinkswizard.class.inc.php

@@ -117,6 +117,8 @@ class UILinksWizard
 					$('#ModalDlg').html(data);
 					dlgWidth = $(document).width() - 100;
 					$('#ModalDlg').css('width', dlgWidth);
+					$('#ModalDlg').css('left', 50);
+					$('#ModalDlg').css('top', 50);
 					$('#ModalDlg').jqmShow();
 				},
 				'html'
@@ -355,7 +357,7 @@ class UILinksWizard
 		$oP->add("<input type=\"button\" value=\"Cancel\" onClick=\"$('#ModalDlg').jqmHide();\">&nbsp;&nbsp;<input type=\"submit\" value=\" Add \">");
 		$oP->Add("</div>\n");
 		$oP->Add("</form>\n");
-		$oP->add_ready_script("$('div#SearchFormToAdd form').attr('onSubmit', 'var the_form = this; return SearchObjectsToAdd(the_form.id);');");
+		$oP->add_ready_script("$('div#SearchFormToAdd form').bind('submit', function() {var the_form = this; SearchObjectsToAdd(the_form.id); return false;});");
 	}
 
 	public function SearchObjectsToAdd(web_page $oP, UserContext $oContext)

+ 9 - 9
application/uiwizard.class.inc.php

@@ -80,12 +80,12 @@ class UIWizard
 		$sDisabled = $bFinishEnabled ? '' : 'disabled';
 		$nbSteps = count($this->m_aWizardSteps['mandatory']) + count($this->m_aWizardSteps['optional']);
 		$this->m_oPage->add("<div style=\"text-align:center\">
-		<input type=\"button\" value=\"&lt;&lt; Back \" $sBackButtonDisabled onClick=\"GoToStep($iStepIndex, $iStepIndex - 1)\">
-		<input type=\"button\" value=\" Next &gt;&gt;\" onClick=\"GoToStep($iStepIndex, 1+$iStepIndex)\">
-		<input type=\"button\" value=\" Finish \" $sDisabled onClick=\"GoToStep($iStepIndex, 1+$nbSteps)\">
+		<input type=\"button\" value=\"&lt;&lt; Back \" $sBackButtonDisabled onClick=\"GoToStep($iStepIndex, $iStepIndex - 1)\" />
+		<input type=\"button\" value=\" Next &gt;&gt;\" onClick=\"GoToStep($iStepIndex, 1+$iStepIndex)\" />
+		<input type=\"button\" value=\" Finish \" $sDisabled onClick=\"GoToStep($iStepIndex, 1+$nbSteps)\" />
 		</div>\n");
 		$this->m_oPage->add("
-<script>
+<script type=\"text/javascript\">
 function OnEnterStep{$iStepIndex}()
 {
 	oWizardHelper.ResetQuery();
@@ -108,10 +108,10 @@ $sJSHandlerCode
 		$this->m_oPage->add("<a name=\"step$iStepIndex\" />\n");
 		$this->m_oPage->P("Final step: confirmation");
 		$this->m_oPage->add("<form method=\"post\" action=\"../pages/UI.php\">\n");
-		$this->m_oPage->add("<input type=\"hidden\" name=\"operation\" value=\"wizard_apply_new\">\n");
-		$this->m_oPage->add("<input type=\"hidden\" name=\"transaction_id\" value=\"".utils::GetNewTransactionId()."\">\n");
-		$this->m_oPage->add("<input type=\"hidden\" id=\"wizard_json_obj\" name=\"json_obj\" value=\"\">\n");
-		$this->m_oPage->add("<script>\n");
+		$this->m_oPage->add("<input type=\"hidden\" name=\"operation\" value=\"wizard_apply_new\" />\n");
+		$this->m_oPage->add("<input type=\"hidden\" name=\"transaction_id\" value=\"".utils::GetNewTransactionId()."\" />\n");
+		$this->m_oPage->add("<input type=\"hidden\" id=\"wizard_json_obj\" name=\"json_obj\" value=\"\" />\n");
+		$this->m_oPage->add("<script type=\"text/javascript\">\n");
 		$this->m_oPage->add("function OnEnterStep$iStepIndex() {\n");
 		foreach($aFieldsMap as $iInputId => $sAttCode)
 		{
@@ -123,7 +123,7 @@ $sJSHandlerCode
 		$this->m_oPage->add("</script>\n");
 		$this->m_oPage->add("<div id=\"object_preview\">\n");
 		$this->m_oPage->add("</div>\n");
-		$this->m_oPage->add("<input type=\"submit\" value=\"Create ".MetaModel::GetName($this->m_sClass)."\">\n");
+		$this->m_oPage->add("<input type=\"submit\" value=\"Create ".MetaModel::GetName($this->m_sClass)."\" />\n");
 		$this->m_oPage->add("</form>\n");
 		$this->m_oPage->add("</div>\n");
 	}	

+ 1 - 1
core/cmdbsource.class.inc.php

@@ -41,7 +41,7 @@ class CMDBSource
 		self::$m_sDBName = $sSource;
 		if (!self::$m_resDBLink = @mysql_pconnect($sServer, $sUser, $sPwd))
 		{
-			throw new MySQLException('Could not connect to the DB server', array('host'=>$sServer, 'user'=>$sUser));
+			throw new MySQLException('Could not connect to the DB server', array('host'=>$sServer));
 		}
 		if (!empty($sSource))
 		{

+ 11 - 13
css/jqModal.css

@@ -2,32 +2,30 @@
 	Brice Burgess <bhb@iceburg.net> */
 
 /* The Window's CSS z-index value is respected (takes priority). If none is supplied,
-	the Window's z-index value will be set to 3000 by default (in jqModal.js). You
-	can change this value by either;
-	  a) supplying one via CSS
-	  b) passing the "zIndex" parameter. E.g.  (window).jqm({zIndex: 500}); */
+	the Window's z-index value will be set to 3000 by default (via jqModal.js). */
 	
 .jqmWindow {
     display: none;
     
     position: fixed;
-    top: 25px;
-    left: 25px;
+    no.top: 17%;
+    no.left: 50%;
     
-    nomargin-left: 25px;
-    nomargin-right: 25px;
-    nowidth: 800px;
+    no.margin-left: -300px;
+    no.width: 700px;
     
-    background-color: #FFF;
+    background-color: #EEE;
     color: #333;
     border: 1px solid black;
     padding: 12px;
+    
+    z-index:9999; 
 }
 
-.jqmOverlay { background-color: #333; }
+.jqmOverlay { background-color: #000; }
 
 /* Background iframe styling for IE6. Prevents ActiveX bleed-through (<select> form elements, etc.) */
-* removed.iframe.jqm {position:absolute;top:0;left:0;z-index:-1;
+* iframe.jqm {position:absolute;top:0;left:0;z-index:-1;
 	width: expression(this.parentNode.offsetWidth+'px');
 	height: expression(this.parentNode.offsetHeight+'px');
 }
@@ -35,7 +33,7 @@
 /* Fixed posistioning emulation for IE6
      Star selector used to hide definition from browsers other than IE6
      For valid CSS, use a conditional include instead */
-* removed.html .jqmWindow {
+* html .jqmWindow {
      position: absolute;
      top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px');
 }

+ 2 - 1
js/wizard.utils.js

@@ -54,6 +54,7 @@ function Manage_LoadSelect(sSelectedId, sFilter)
 
 function Manage_SwapSelectedObjects(oSourceSelect, oDestinationSelect, sId)
 {
+	j = oDestinationSelect.options.length;
 	for (i=oSourceSelect.length-1;i>=0;i--) // Count down because we are removing the indexes from the combo
 	{
 		if (oSourceSelect.options[i].selected)
@@ -61,7 +62,7 @@ function Manage_SwapSelectedObjects(oSourceSelect, oDestinationSelect, sId)
 			var newOption = document.createElement('option');
 			newOption.text = oSourceSelect.options[i].text;
 			newOption.value = oSourceSelect.options[i].value;
-			oDestinationSelect.add(newOption, null);
+			oDestinationSelect.options[j++] = newOption;
 			oSourceSelect.remove(i);
 		}
 	}