Skip to content
Permalink
Browse files

improve NUTS entity display; updates #1126

  • Loading branch information...
following5 committed Oct 8, 2017
1 parent 853084e commit 0f6aad155cfd03190daf274577da7e362effe1d1
Showing with 272 additions and 242 deletions.
  1. +16 −0 bin/dbsv-update.php
  2. +2 −2 htdocs/templates2/ocstyle/viewcache.tpl
  3. +17 −3 htdocs/viewcache.php
  4. +234 −234 sql/static-data/countries.sql
  5. +3 −3 sql/static-data/nuts_codes.sql
@@ -1413,6 +1413,22 @@ function dbv_167()
sql("DELETE FROM `sys_cron` WHERE `name` = 'okapi_cleanup'");
}
function dbv_168()
{
// add nuts entity display selection to countries
if (!sql_field_exists('countries', 'adm_display2')) {
sql('ALTER TABLE `countries` ADD COLUMN `adm_display2` TINYINT(1) NOT NULL');
}
if (!sql_field_exists('countries', 'adm_display3')) {
sql('ALTER TABLE `countries` ADD COLUMN `adm_display3` TINYINT(1) NOT NULL');
}
// improve some NUTS 2 entity names
sql("UPDATE `cache_location` SET `adm3`='Burgenland' WHERE `code3`='AT11'");
sql("UPDATE `cache_location` SET `adm3`='Prov. Limburg' WHERE `code3`='BE22'");
sql("UPDATE `cache_location` SET `adm3`='Luxembourg' WHERE `code3`='BE34'");
}
// When adding new mutations, take care that they behave well if run multiple
// times. This improves robustness of database versioning.
@@ -171,8 +171,8 @@
{else}
<img src="images/flags/{$cache.code1|lower}.gif" style="vertical-align:middle" />&nbsp;
{$cache.adm1|escape} {if $cache.adm1!=null & $cache.adm2!=null} &gt; {/if}
{$cache.adm2|escape} {if ($cache.adm2!=null & $cache.adm4!=null) | ($cache.adm1!=null & $cache.adm4!=null)} &gt; {/if}
{$cache.adm4|escape}
{$cache.adm2|escape} {if ($cache.adm2!=null & $cache.adm3!=null) | ($cache.adm1!=null & $cache.adm3!=null)} &gt; {/if}
{$cache.adm3|escape}
{/if}
</span>
</p>
@@ -146,9 +146,23 @@ function getChildWaypoints($cacheid)
`user`.`username` AS `username`,
IFNULL(`cache_location`.`code1`, '') AS `code1`,
IFNULL(`trans2`.`text`, IFNULL(`cache_location`.`adm1`,'')) AS `adm1`,
IFNULL(`cache_location`.`adm2`, '') AS `adm2`,
IFNULL(`cache_location`.`adm3`, '') AS `adm3`,
IFNULL(`cache_location`.`adm4`, '') AS `adm4`
IF(
`countries`.`adm_display2`=2, `cache_location`.`adm2`,
IF (
`countries`.`adm_display2`=3, `cache_location`.`adm3`,
IF (
`countries`.`adm_display2`=4, `cache_location`.`adm4`,
NULL
)
)
) AS `adm2`,
IF (
`countries`.`adm_display3`=3, `cache_location`.`adm3`,
IF (
`countries`.`adm_display3`=4, `cache_location`.`adm4`,
NULL
)
) AS `adm3`
FROM `caches`
INNER JOIN `user`
ON `caches`.`user_id`=`user`.`user_id`
Oops, something went wrong.

0 comments on commit 0f6aad1

Please sign in to comment.
You can’t perform that action at this time.