Dear,
I am using Ushahidi 2.7 and I am trying to make a more
detailed label for the layers I use. So far I've figured out how to
add the data, but I don't want to show it all (in order not to
confuse people). To do this, I added some html (I underlined this in this email) in
"layout.php" (themes/default/views/main/layout.php) and
this seems to be working well. You can see the example here:http://hcer.info/talawis
<blockquote><!-- Layers (KML/KMZ) -->
<div class="layers-filters clearingfix">
<strong><?php echo Kohana::lang('ui_main.layers_filter');?>
<span>
[<a href="javascript:toggleLayer('kml_switch_link', 'kml_switch')" id="kml_switch_link">
<?php echo Kohana::lang('ui_main.hide'); ?>
</a>]
</span>
</strong>
</div>
<ul id="kml_switch" class="category-filters">
<li><span class="swatch" style="background-color:#e2001a"></span><span class="legend">شكاوة</span>
<br>
<?php
foreach ($layers as $layer => $layer_info)
{
$layer_name = $layer_info[0];
$layer_color = $layer_info[1];
$layer_url = $layer_info[2];
$layer_file = $layer_info[3];
$layer_link = ( ! $layer_url)
? url::base().Kohana::config('upload.relative_directory').'/'.$layer_file
: $layer_url;
echo '<li>'
. '<a href="#" id="layer_'. $layer .'">'
. '<span class="swatch" style="background-color:#'.$layer_color.'"></span>'
. '<span class="layer-name">'.$layer_name.'</span>'
. '</a>'
. '</li>'
. '<li>'
. '<span class="swatch" style="background-color:#004b7d"></span>'
. '<span class="legend">في القاهرة و المحافظات</span>'
. '</li>'
. '<br>'
. '<li>'
. '<span class="swatch" style="background-color:#95d4e6"></span>'
. '<span class="legend">في المدن الجديدة<span>'
. '</li>'
. '<br>';
}
?>
</ul>
<!-- /Layers -->
</blockquote>
The next thing I'm trying to do, is to make this detailed label conditional of which layer is active; I now have two layers, with each two labels, and I only want to show the labels of the layers who's active.
I tried to add " if ( $('layer').hasClass("active"))" but this gives an error, does anyone know how to help me out?
<blockquote>
<!-- Layers (KML/KMZ) -->
<div class="layers-filters clearingfix">
<strong><?php echo Kohana::lang('ui_main.layers_filter');?>
<span>
[<a href="javascript:toggleLayer('kml_switch_link', 'kml_switch')" id="kml_switch_link">
<?php echo Kohana::lang('ui_main.hide'); ?>
</a>]
</span>
</strong>
</div>
<ul id="kml_switch" class="category-filters">
<li><span class="swatch" style="background-color:#e2001a"></span><span class="legend">شكاوة</span>
<br>
<?php
foreach ($layers as $layer => $layer_info)
{
$layer_name = $layer_info[0];
$layer_color = $layer_info[1];
$layer_url = $layer_info[2];
$layer_file = $layer_info[3];
$layer_link = ( ! $layer_url)
? url::base().Kohana::config('upload.relative_directory').'/'.$layer_file
: $layer_url;
echo '<li>'
. '<a href="#" id="layer_'. $layer .'">'
. '<span class="swatch" style="background-color:#'.$layer_color.'"></span>'
. '<span class="layer-name">'.$layer_name.'</span>'
. '</a>'
. '</li>';
if ( $('layer').hasClass("active"))
{
echo '<li>'
. '<span class="swatch" style="background-color:#004b7d"></span>'
. '<span class="legend">في القاهرة و المحافظات</span>'
. '</li>'
. '<br>'
. '<li>'
. '<span class="swatch" style="background-color:#95d4e6"></span>'
. '<span class="legend">في المدن الجديدة<span>'
. '</li>'
. '<br>';
}
}
?>
</ul>
<!-- /Layers -->
<\blockquote>
I also have a smaller question, I'm trying to change the swatch in the label from a square to a circle. I changed the image type from rec to cir in swatch.php (in application/controllers/swatch.php), but this doesn't seem to change anything.
Thank you very much, Does