Procházet zdrojové kódy

Customer portal : Portal logo source order is : "/images/itop-logo.png" < "/env-xxx/branding/portal-logo.png" < "value of //properties/logo of the portal module_design"

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4078 a333f486-631f-4898-b8df-5754b55c2be0
glajarige před 9 roky
rodič
revize
475970d9cc

+ 11 - 19
datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php

@@ -283,14 +283,14 @@ class ApplicationHelper
 				throw new Exception('Cannot load module design, Portal ID is not defined');
 			}
 			$oDesign = new ModuleDesign(PORTAL_ID);
-
+			
 			// Parsing file
 			// - Default values
 			$aPortalConf = array(
 				'properties' => array(
 					'id' => PORTAL_ID,
 					'name' => 'Page:DefaultTitle',
-					'logo' => null,
+					'logo' => (file_exists(MODULESROOT . 'branding/portal-logo.png')) ? utils::GetAbsoluteUrlModulesRoot() . 'branding/portal-logo.png' : '../images/itop-logo.png',
 					'themes' => array(
 						'bootstrap' => $oApp['combodo.portal.base.absolute_url'] . 'css/bootstrap-theme.min.css',
 						'portal' => $oApp['combodo.portal.base.absolute_url'] . 'css/portal.css',
@@ -321,23 +321,7 @@ class ApplicationHelper
 						$aPortalConf['properties'][$oPropertyNode->nodeName] = $oPropertyNode->GetText($aPortalConf['properties'][$oPropertyNode->nodeName]);
 						break;
 					case 'logo':
-						$sLogoUri = $oPropertyNode->GetText($aPortalConf['properties'][$oPropertyNode->nodeName]);
-
-						if ($sLogoUri === null)
-						{
-							// There is no logo : do nothing
-						}
-						elseif (preg_match('/^http/', $sLogoUri))
-						{
-							// The uri is already complete : do nothing
-						}
-						else
-						{
-							// We prefix it with the server base url
-							$sLogoUri = utils::GetAbsoluteUrlAppRoot() . 'env-' . utils::GetCurrentEnvironment() . '/' . $sLogoUri;
-						}
-
-						$aPortalConf['properties'][$oPropertyNode->nodeName] = $sLogoUri;
+						$aPortalConf['properties'][$oPropertyNode->nodeName] = $oPropertyNode->GetText($aPortalConf['properties'][$oPropertyNode->nodeName]);
 						break;
 					case 'themes':
 					case 'templates':
@@ -398,6 +382,14 @@ class ApplicationHelper
 						break;
 				}
 			}
+			// - Rectifying portal logo url
+			$sLogoUri = $aPortalConf['properties']['logo'];
+			if (!preg_match('/^http/', $sLogoUri))
+			{
+				// We prefix it with the server base url
+				$sLogoUri = utils::GetAbsoluteUrlAppRoot() . 'env-' . utils::GetCurrentEnvironment() . '/' . $sLogoUri;
+			}
+			$aPortalConf['properties']['logo'] = $sLogoUri;
 			// - User allowed portals
 			$aPortalConf['portals'] = UserRights::GetAllowedPortals();
 			// - Bricks

+ 4 - 4
datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml

@@ -962,10 +962,10 @@
   <module_designs>
     <module_design id="itop-portal" xsi:type="portal" _delta="define">
       <properties>
-        <name>Portal:Instance:Name</name>
-        <!-- Can be either a fileref or a relative path to the file (To be tested) -->
-        <!--<fileref ref="brt_6a2be154b2a62659d3332c513bdad715"  />-->
-        <logo>../images/itop-logo.png</logo>
+        <name>portal:itop-portal</name>
+        <!-- Can be either a fileref or a relative path to the file (To be tested). Takes over env-xxx/branding/portal-logo.png -->
+		<!--<fileref ref="brt_6a2be154b2a62659d3332c513bdad715"  />-->
+		<!--<logo>../images/itop-logo.png</logo>-->
         <!-- Can be either a fileref or a relative path to the file from /env-xxx -->
         <!-- Available themes must have a unique id. Some ids are loaded in a specific order : bootstrap/portal/custom. Other ids are loaded after them, but their order cannot be predicted -->
         <themes/>