From: <jon...@us...> - 2012-07-08 20:41:08
|
Revision: 42278 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=42278&view=rev Author: jonnybradley Date: 2012-07-08 20:41:02 +0000 (Sun, 08 Jul 2012) Log Message: ----------- [FIX] breadcrumbs: Use menu item title instead of page title if found, and hide the label if nothing showing (plus a typo fix) Modified Paths: -------------- branches/9.x/lib/breadcrumblib.php branches/9.x/lib/prefs/feature.php branches/9.x/modules/mod-func-breadcrumbs.php branches/9.x/templates/modules/mod-breadcrumbs.tpl Modified: branches/9.x/lib/breadcrumblib.php =================================================================== --- branches/9.x/lib/breadcrumblib.php 2012-07-08 20:01:23 UTC (rev 42277) +++ branches/9.x/lib/breadcrumblib.php 2012-07-08 20:41:02 UTC (rev 42278) @@ -231,8 +231,11 @@ } $level = 0; + $foundSelected = false; + foreach($menuOptions['data'] as $option) { - if (!empty($option['selectedAscendant'])) { + if (!empty($option['selectedAscendant']) || !empty($option['selected'])) { + $foundSelected = true; if ($startLevel === null || $level >= $startLevel) { if ($stopLevel === null || $level <= $stopLevel) { $newCrumbs[] = new Breadcrumb($option['name'], '', $option['url']); @@ -242,7 +245,7 @@ } } - if (count($crumbs) > 1) { + if (!$foundSelected && count($crumbs) > 1) { $newCrumbs[] = $crumbs[1]; } return $newCrumbs; Modified: branches/9.x/lib/prefs/feature.php =================================================================== --- branches/9.x/lib/prefs/feature.php 2012-07-08 20:01:23 UTC (rev 42277) +++ branches/9.x/lib/prefs/feature.php 2012-07-08 20:41:02 UTC (rev 42278) @@ -1665,7 +1665,7 @@ 'name' => tra('Site location bar'), 'type' => 'list', 'options' => array( - 'y' => tra('Use breadcrambs module'), + 'y' => tra('Use breadcrumbs module'), 'page' => tra('Top of center column (legacy mode)'), 'n' => tra('None'), ), Modified: branches/9.x/modules/mod-func-breadcrumbs.php =================================================================== --- branches/9.x/modules/mod-func-breadcrumbs.php 2012-07-08 20:01:23 UTC (rev 42277) +++ branches/9.x/modules/mod-func-breadcrumbs.php 2012-07-08 20:41:02 UTC (rev 42278) @@ -95,6 +95,15 @@ if ($module_params['showLast'] === 'n' && ($module_params['showFirst'] === 'n' || count($crumbs) > 1)) { $crumbs[count($crumbs) - 1]->hidden = true; } + + $hide = true; + foreach($crumbs as $crumb) { + if (!$crumb->hidden) { + $hide = false; + } + } + $smarty->assign('crumbs_all_hidden', $hide); + $smarty->assign_by_ref('trail', $crumbs); $smarty->assign('module_params', $module_params); Modified: branches/9.x/templates/modules/mod-breadcrumbs.tpl =================================================================== --- branches/9.x/templates/modules/mod-breadcrumbs.tpl 2012-07-08 20:01:23 UTC (rev 42277) +++ branches/9.x/templates/modules/mod-breadcrumbs.tpl 2012-07-08 20:41:02 UTC (rev 42278) @@ -4,7 +4,7 @@ {strip} {if $prefs.feature_siteloc eq 'y' and $prefs.feature_breadcrumbs eq 'y'} <div id="sitelocbar"> - {if !empty($module_params.label)}{tr}{$module_params.label|escape:"html"}{/tr} {/if} + {if !empty($module_params.label) and not $crumbs_all_hidden}{tr}{$module_params.label|escape:"html"}{/tr} {/if} {if $trail} {breadcrumbs type="trail" loc="site" crumbs=$trail showLinks=$module_params.showLinks} {else} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |