Revision: 46401
Author:   mchatzidakis
Date:     2014-09-23 14:02:23 +0200 (Tue, 23 Sep 2014)
Log Message:
-----------
CHANNELMGR-46: Wrong order for backwards compatibility

Modified Paths:
--------------
    
hippo-cms7/addons/addon-channel-manager/branches/hippo-addon-channel-manager-2.26.xx/frontend/src/main/java/org/onehippo/cms7/channelmanager/channels/CountryGroupingChannelStore.java

Modified: 
hippo-cms7/addons/addon-channel-manager/branches/hippo-addon-channel-manager-2.26.xx/frontend/src/main/java/org/onehippo/cms7/channelmanager/channels/CountryGroupingChannelStore.java
===================================================================
--- 
hippo-cms7/addons/addon-channel-manager/branches/hippo-addon-channel-manager-2.26.xx/frontend/src/main/java/org/onehippo/cms7/channelmanager/channels/CountryGroupingChannelStore.java
      2014-09-23 11:45:42 UTC (rev 46400)
+++ 
hippo-cms7/addons/addon-channel-manager/branches/hippo-addon-channel-manager-2.26.xx/frontend/src/main/java/org/onehippo/cms7/channelmanager/channels/CountryGroupingChannelStore.java
      2014-09-23 12:02:23 UTC (rev 46401)
@@ -64,30 +64,31 @@
         //Try to find the country flag icon in the repository using channel's 
country information (derived from its locale)
         String countryIconUrl = getChannelIconUrl(channelFieldValues, 
getChannelRegionIconPath());
 
-        //else, try finding it as a resource in the filesystem, using again 
that country property
+        //else, try finding it in the repository but now using the channel's 
locale property (for backwards compatibility)
         if (StringUtils.isEmpty(countryIconUrl) && 
!UNKNOWN_COUNTRYCODE.equals(countryCode)) {
-            countryIconUrl = getIconResourceReferenceUrl(countryCode + ".png");
-
-            //else, try finding it in the repository but now using the 
channel's locale property (for backwards compatibility)
-            if (StringUtils.isEmpty(countryIconUrl)) {
                 //Fallback: we now consider the region field to have the same 
value as the locale
                 String locale = channel.getLocale();
                 if (StringUtils.isNotBlank(locale)) {
                     channelFieldValues.put("region", locale.toLowerCase());
                     countryIconUrl = getChannelIconUrl(channelFieldValues, 
getChannelRegionIconPath());
+            }
+        }
 
+        //else, try finding it as a resource in the filesystem, using again 
that country property
+        if (StringUtils.isEmpty(countryIconUrl) && 
!UNKNOWN_COUNTRYCODE.equals(countryCode)) {
+            countryIconUrl = getIconResourceReferenceUrl(countryCode + ".png");
+        }
+
                     //else, try finding it as a resource in the filesystem, 
using again channel's locale property (for backwards compatibility)
-                    if (StringUtils.isEmpty(countryIconUrl)) {
-                        countryIconUrl = getIconResourceReferenceUrl(locale + 
".png");
+        if (StringUtils.isEmpty(countryIconUrl) && 
!UNKNOWN_COUNTRYCODE.equals(countryCode)) {
+            countryIconUrl = getIconResourceReferenceUrl(channel.getLocale() + 
".png");
+        }
 
                         //else, show the default "unknown" country icon, this 
is loaded from filesystem and it always exists
-                        if (StringUtils.isEmpty(countryIconUrl)) {
+        if (StringUtils.isEmpty(countryIconUrl) && 
!UNKNOWN_COUNTRYCODE.equals(countryCode)) {
                             countryIconUrl = 
getIconResourceReferenceUrl(UNKNOWN_COUNTRYCODE + ".png");
                         }
-                    }
-                }
-            }
-        }
+
         object.put("channelRegionImg", countryIconUrl);
     }
 

_______________________________________________
Hippocms-svn mailing list
[email protected]
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to