瀏覽代碼

Make sure that the stylesheets and favicons are reloaded when the application is upgraded.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3784 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 9 年之前
父節點
當前提交
05a16050ed
共有 2 個文件被更改,包括 21 次插入5 次删除
  1. 11 3
      application/itopwebpage.class.inc.php
  2. 10 2
      application/webpage.class.inc.php

+ 11 - 3
application/itopwebpage.class.inc.php

@@ -675,18 +675,26 @@ EOF
 		// jQuery scripts may face some spurious problems (like failing on a 'reload')
 		foreach($this->a_linked_stylesheets as $a_stylesheet)
 		{
+			if (strpos($a_stylesheet['link'], '?') === false)
+			{
+				$s_stylesheet = $a_stylesheet['link']."?itopversion=".ITOP_VERSION;
+			}
+			else
+			{
+				$s_stylesheet = $a_stylesheet['link']."&itopversion=".ITOP_VERSION;
+			}
 			if ($a_stylesheet['condition'] != "")
 			{
 				$sHtml .= "<!--[if {$a_stylesheet['condition']}]>\n";
 			}
-			$sHtml .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$a_stylesheet['link']}\" />\n";
+			$sHtml .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$s_stylesheet}\" />\n";
 			if ($a_stylesheet['condition'] != "")
 			{
 				$sHtml .= "<![endif]-->\n";
 			}
 		}
 		// special stylesheet for printing, hides the navigation gadgets
-		$sHtml .= "<link rel=\"stylesheet\" media=\"print\" type=\"text/css\" href=\"../css/print.css\" />\n";
+		$sHtml .= "<link rel=\"stylesheet\" media=\"print\" type=\"text/css\" href=\"../css/print.css?itopversion=".ITOP_VERSION."\" />\n";
 
 		if ($this->GetOutputFormat() == 'html')
 		{
@@ -764,7 +772,7 @@ EOF
 			$sHtml .= "</style>\n";
 		}
 		$sHtml .= "<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"iTop\" href=\"".utils::GetAbsoluteUrlAppRoot()."pages/opensearch.xml.php\" />\n";
-		$sHtml .= "<link rel=\"shortcut icon\" href=\"".utils::GetAbsoluteUrlAppRoot()."images/favicon.ico\" />\n";
+		$sHtml .= "<link rel=\"shortcut icon\" href=\"".utils::GetAbsoluteUrlAppRoot()."images/favicon.ico?itopversion=".ITOP_VERSION."\" />\n";
 	
 		$sHtml .= "</head>\n";
 		$sBodyClass = "";

+ 10 - 2
application/webpage.class.inc.php

@@ -525,11 +525,19 @@ class WebPage implements Page
         $this->output_dict_entries();
         foreach($this->a_linked_stylesheets as $a_stylesheet)
         {
+			if (strpos($a_stylesheet['link'], '?') === false)
+			{
+				$s_stylesheet = $a_stylesheet['link']."?itopversion=".ITOP_VERSION;
+			}
+			else
+			{
+				$s_stylesheet = $a_stylesheet['link']."&itopversion=".ITOP_VERSION;
+			}
 			if ($a_stylesheet['condition'] != "")
 			{
 				echo "<!--[if {$a_stylesheet['condition']}]>\n";
 			}
-            echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$a_stylesheet['link']}\" />\n";
+			echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"{$s_stylesheet}\" />\n";
 			if ($a_stylesheet['condition'] != "")
 			{
 				echo "<![endif]-->\n";
@@ -547,7 +555,7 @@ class WebPage implements Page
         }
         if (class_exists('MetaModel') && MetaModel::GetConfig())
         {
- 			echo "<link rel=\"shortcut icon\" href=\"".utils::GetAbsoluteUrlAppRoot()."images/favicon.ico\" />\n";
+ 			echo "<link rel=\"shortcut icon\" href=\"".utils::GetAbsoluteUrlAppRoot()."images/favicon.ico?itopversion=".ITOP_VERSION."\" />\n";
         }
         echo "</head>\n";
         echo "<body>\n";