@@ -13,124 +13,114 @@
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
*/
?>
<div class="bg">
<h2>
<?php members::alerts_subtabs("view"); ?>
</h2>
<div class="bg">
<h2>
<?php members::alerts_subtabs("view"); ?>
</h2>

<!-- tabs -->
<div class="tabs">
<!-- tabset -->
<ul class="tabset">
<li><a href="<?php echo url::site()."members/alerts/"; ?>" <?php if ($type == '0' OR empty($type) ) echo "class=\"active\""; ?>><?php echo Kohana::lang('ui_main.show_all');?></a></li>
<li><a href="<?php echo url::site()."members/alerts/index/"; ?>?type=1" <?php if ($type == '1') echo "class=\"active\""; ?>><?php echo Kohana::lang('ui_main.sms');?></a></li>
<li><a href="<?php echo url::site()."members/alerts/index/"; ?>?type=2" <?php if ($type == '2') echo "class=\"active\""; ?>><?php echo Kohana::lang('ui_main.email');?></a></li>
</ul>
<!-- tab -->
<div class="tab">
<ul>
<li><a href="#" onClick="alertsAction('d', 'DELETE', '')"><?php echo utf8::strtoupper(Kohana::lang('ui_main.delete'));?></a></li>
</ul>
</div>
</div>
<?php
if ($form_error) {
?>
<!-- red-box -->
<div class="red-box">
<h3><?php echo Kohana::lang('ui_main.error');?></h3>
<ul><?php echo Kohana::lang('ui_main.select_one');?></ul>
</div>
<?php
}
<!-- tabs -->
<div class="tabs">
<!-- tabset -->
<ul class="tabset">
<li><a href="<?php echo url::site()."members/alerts/"; ?>" <?php if ($type == '0' OR empty($type) ) echo "class=\"active\""; ?>><?php echo Kohana::lang('ui_main.show_all');?></a></li>
<li><a href="<?php echo url::site()."members/alerts/index/"; ?>?type=1" <?php if ($type == '1') echo "class=\"active\""; ?>><?php echo Kohana::lang('ui_main.sms');?></a></li>
<li><a href="<?php echo url::site()."members/alerts/index/"; ?>?type=2" <?php if ($type == '2') echo "class=\"active\""; ?>><?php echo Kohana::lang('ui_main.email');?></a></li>
</ul>
<!-- tab -->
<div class="tab">
<ul>
<li><a href="#" onClick="alertsAction('d', 'DELETE', '')"><?php echo utf8::strtoupper(Kohana::lang('ui_main.delete'));?></a></li>
</ul>
</div>
</div>
<?php if ($form_error): ?>
<!-- red-box -->
<div class="red-box">
<h3><?php echo Kohana::lang('ui_main.error');?></h3>
<ul><?php echo Kohana::lang('ui_main.select_one');?></ul>
</div>
<?php endif; ?>

<?php if ($form_saved): ?>
<!-- green-box -->
<div class="green-box" id="submitStatus">
<h3><?php echo Kohana::lang('ui_main.messages');?> <?php echo $form_action; ?> <a href="#" id="hideMessage" class="hide">hide this message</a></h3>
</div>
<?php endif; ?>

<!-- report-table -->
<?php print form::open(NULL, array('id' => 'alertsMain', 'name' => 'alertsMain')); ?>
<input type="hidden" name="action" id="action" value="">
<input type="hidden" name="level" id="level" value="">
<input type="hidden" name="alert_id[]" id="alert_single" value="">
<div class="table-holder">
<table class="table">
<thead>
<tr>
<th class="col-1"><input id="checkall" type="checkbox" class="check-box" onclick="CheckAll( this.id, 'alert_id[]' )" /></th>
<th class="col-2"><?php echo Kohana::lang('ui_admin.alerts');?></th>
<th class="col-3"><?php echo Kohana::lang('ui_admin.alerts_received');?></th>
<th class="col-4"><?php echo Kohana::lang('ui_main.actions');?></th>
</tr>
</thead>
<tfoot>
<tr class="foot">
<td colspan="4">
<?php echo $pagination; ?>
</td>
</tr>
</tfoot>
<tbody>
<?php if ($total_items == 0): ?>
<tr>
<td colspan="4" class="col">
<h3><?php echo Kohana::lang('ui_main.no_results');?></h3>
</td>
</tr>
<?php endif; ?>

if ($form_saved) {
?>
<!-- green-box -->
<div class="green-box" id="submitStatus">
<h3><?php echo Kohana::lang('ui_main.messages');?> <?php echo $form_action; ?> <a href="#" id="hideMessage" class="hide">hide this message</a></h3>
</div>
<?php
}
foreach ($alerts as $alert):
$alert_id = $alert->id;
$alert_type = $alert->alert_type;
$alert_lat = $alert->alert_lat;
$alert_lon = $alert->alert_lon;
$alert_radius = $alert->alert_radius;

$alert_count = $alert->alert_sent->count();
$categories = $alert->alert_category;
?>
<!-- report-table -->
<?php print form::open(NULL, array('id' => 'alertsMain', 'name' => 'alertsMain')); ?>
<input type="hidden" name="action" id="action" value="">
<input type="hidden" name="level" id="level" value="">
<input type="hidden" name="alert_id[]" id="alert_single" value="">
<div class="table-holder">
<table class="table">
<thead>
<tr>
<th class="col-1"><input id="checkall" type="checkbox" class="check-box" onclick="CheckAll( this.id, 'alert_id[]' )" /></th>
<th class="col-2"><?php echo Kohana::lang('ui_admin.alerts');?></th>
<th class="col-3"><?php echo Kohana::lang('ui_admin.alerts_received');?></th>
<th class="col-4"><?php echo Kohana::lang('ui_main.actions');?></th>
</tr>
</thead>
<tfoot>
<tr class="foot">
<td colspan="4">
<?php echo $pagination; ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
if ($total_items == 0)
{
?>
<tr>
<td colspan="4" class="col">
<h3><?php echo Kohana::lang('ui_main.no_results');?></h3>
</td>
</tr>
<?php
}
foreach ($alerts as $alert)
<tr>
<td class="col-1"><input name="alert_id[]" id="alert" value="<?php echo $alert_id; ?>" type="checkbox" class="check-box"/></td>
<td class="col-2">
<div class="post">
<p><?php echo $alert_lat.", ".$alert_lon; ?></p>
<p><a href="javascript:showAlert('alert_preview_<?php echo $alert_id?>', '<?php echo $alert_lon?>', '<?php echo $alert_lat?>', '<?php echo $alert_radius?>')"><?php echo Kohana::lang('ui_admin.preview');?></a></p>
<div id="alert_preview_<?php echo $alert_id?>" class="preview_div">
<div id="alert_preview_<?php echo $alert_id?>_map" class="checkin_map"></div>
</div>
</div>
<ul class="info">
<li class="none-separator">Radius: <strong><?php echo $alert_radius; ?></strong></li>

<li>Categories: <strong><?php
foreach ($categories as $alert_category)
{
$alert_id = $alert->id;
$alert_type = $alert->alert_type;
$alert_lat = $alert->alert_lat;
$alert_lon = $alert->alert_lon;
$alert_radius = $alert->alert_radius;

$alert_count = $alert->alert_sent->count();
$categories = $alert->alert_category;
?>
<tr>
<td class="col-1"><input name="alert_id[]" id="alert" value="<?php echo $alert_id; ?>" type="checkbox" class="check-box"/></td>
<td class="col-2">
<div class="post">
<p><?php echo $alert_lat.", ".$alert_lon; ?></p>
<p><a href="javascript:showAlert('alert_preview_<?php echo $alert_id?>', '<?php echo $alert_lon?>', '<?php echo $alert_lat?>', '<?php echo $alert_radius?>')"><?php echo Kohana::lang('ui_admin.preview');?></a></p>
<div id="alert_preview_<?php echo $alert_id?>" class="preview_div">
<div id="alert_preview_<?php echo $alert_id?>_map" class="checkin_map"></div>
</div>
</div>
<ul class="info">
<li class="none-separator">Radius: <strong><?php echo $alert_radius; ?></strong></li>

<li>Categories: <strong><?php
foreach ($categories as $alert_category)
{
echo $alert_category->category->category_title.", ";
}
?></strong></li>
</ul>
</td>
<td class="col-3"><?php echo $alert_count; ?></td>
<td class="col-4">
<ul>
<li class="none-separator"><a href="javascript:alertsAction('d','DELETE','<?php echo(rawurlencode($alert_id)); ?>')" class="del"><?php echo Kohana::lang('ui_main.delete');?></a></li>
</ul>
</td>
</tr>
<?php
echo $alert_category->category->category_title.", ";
}
?>
</tbody>
</table>
</div>
<?php print form::close(); ?>
</div>
?></strong></li>
</ul>
</td>
<td class="col-3"><?php echo $alert_count; ?></td>
<td class="col-4">
<ul>
<li class="none-separator"><a href="javascript:alertsAction('d','DELETE','<?php echo(rawurlencode($alert_id)); ?>')" class="del"><?php echo Kohana::lang('ui_main.delete');?></a></li>
</ul>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php print form::close(); ?>
</div>
@@ -1,12 +1,5 @@
<?php require APPPATH.'views/admin/utils_js.php' ?>
var map;
var proj_4326 = new OpenLayers.Projection('EPSG:4326');
var proj_900913 = new OpenLayers.Projection('EPSG:900913');
var latitude;
var longitude;
var markers;
var linestring;
var radiusLayer;

function showAlert(id, lon, lat, radius) {
if (id) {
@@ -27,85 +20,30 @@ function showAlert(id, lon, lat, radius) {
}

function showMap(id, lon, lat, radius) {
/*
- Initialize Map
- Uses Spherical Mercator Projection
- Units in Metres instead of Degrees
*/
var options = {
units: "dd",
numZoomLevels: 16,
controls:[],
projection: proj_900913,
'displayProjection': proj_4326,
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
maxResolution: 156543.0339
<?php echo map::layers_js(FALSE); ?>
var mapConfig = {

// Map center
center: {
latitude: lat,
longitude: lon,
},

// Zoom level
zoom: <?php echo Kohana::config('settings.default_zoom'); ?>,

// Base layers
baseLayers: <?php echo map::layers_array(FALSE); ?>
};

map = new OpenLayers.Map(id + '_map', options);

<?php echo map::layers_js(FALSE); ?>
map.addLayers(<?php echo map::layers_array(FALSE); ?>);

map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.LayerSwitcher());

// Create the Circle/Radius layer
radiusLayer = new OpenLayers.Layer.Vector("Radius Layer");

style = new OpenLayers.Style({
fillColor: "#<?php echo Kohana::config('settings.default_map_all'); ?>",
fillOpacity: 0.8,
strokeColor: "white",
strokeOpacity: 1,
pointRadius: "8"
});

var vectorLayer = new OpenLayers.Layer.Vector("Alert", {
styleMap: new OpenLayers.StyleMap({
"default":style,
"select": style
})
});

var lonlat = new OpenLayers.LonLat(lon, lat);
lonlat.transform(proj_4326, proj_900913);
map.setCenter(lonlat, 9);

point = new OpenLayers.Geometry.Point(lon, lat);
point.transform(proj_4326, proj_900913);
var origFeature = new OpenLayers.Feature.Vector(point);
vectorLayer.addFeatures(origFeature);
map.addLayers([radiusLayer, vectorLayer]);

// draw circle around point
drawCircle(lon,lat,radius);
}
// Initialize the map
map = new Ushahidi.Map(id + '_map', mapConfig);

/**
* Draw circle around point
*/
function drawCircle(lon,lat,radius)
{
radiusLayer.destroyFeatures();

radius = radius * 1000;
var circOrigin = new OpenLayers.Geometry.Point(lon,lat);
circOrigin.transform(proj_4326, proj_900913);

var circStyle = OpenLayers.Util.extend( {},OpenLayers.Feature.Vector.style["default"] );
var circleFeature = new OpenLayers.Feature.Vector(
OpenLayers.Geometry.Polygon.createRegularPolygon( circOrigin, radius, 40, 0 ),
null,
circStyle
);
radiusLayer.addFeatures( [circleFeature] );
// Add the radius layer
map.addRadiusLayer({latitude: lat, longitude: lon});
}

function alertsAction ( action, confirmAction, alert_id )
{
function alertsAction (action, confirmAction, alert_id) {
var statusMessage;
if( !isChecked( "alert" ) && alert_id=='' )
{
@@ -13,148 +13,137 @@
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
*/
?>
<div class="bg">
<h2>
<?php echo Kohana::lang('ui_admin.my_checkins'); ?>
</h2>
<div class="bg">
<h2>
<?php echo Kohana::lang('ui_admin.my_checkins'); ?>
</h2>

<!-- tabs -->
<div class="tabs">
<!-- tabset -->
<ul class="tabset">
<li><a href="#" class="active"><?php echo Kohana::lang('ui_main.show_all');?></a></li>
</ul>
<!-- tab -->
<div class="tab">
<ul>
<li><a href="#" onClick="checkinAction('d', 'DELETE', '')"><?php echo utf8::strtoupper(Kohana::lang('ui_main.delete'));?></a></li>
</ul>
</div>
</div>
<?php
if ($form_error) {
?>
<!-- red-box -->
<div class="red-box">
<h3><?php echo Kohana::lang('ui_main.error');?></h3>
<ul><?php echo Kohana::lang('ui_main.select_one');?></ul>
</div>
<?php
}
<!-- tabs -->
<div class="tabs">
<!-- tabset -->
<ul class="tabset">
<li><a href="#" class="active"><?php echo Kohana::lang('ui_main.show_all');?></a></li>
</ul>
<!-- tab -->
<div class="tab">
<ul>
<li><a href="#" onClick="checkinAction('d', 'DELETE', '')"><?php echo utf8::strtoupper(Kohana::lang('ui_main.delete'));?></a></li>
</ul>
</div>
</div>
<?php if ($form_error): ?>
<!-- red-box -->
<div class="red-box">
<h3><?php echo Kohana::lang('ui_main.error');?></h3>
<ul><?php echo Kohana::lang('ui_main.select_one');?></ul>
</div>
<?php endif; ?>

if ($form_saved) {
?>
<!-- green-box -->
<div class="green-box" id="submitStatus">
<h3><?php echo Kohana::lang('ui_admin.checkins');?> <?php echo $form_action; ?> <a href="#" id="hideMessage" class="hide">hide this message</a></h3>
</div>
<?php if ($form_saved): ?>
<!-- green-box -->
<div class="green-box" id="submitStatus">
<h3><?php echo Kohana::lang('ui_admin.checkins');?> <?php echo $form_action; ?> <a href="#" id="hideMessage" class="hide">hide this message</a></h3>
</div>
<?php endif; ?>

<!-- report-table -->
<?php print form::open(NULL, array('id' => 'checkinMain', 'name' => 'checkinMain')); ?>
<input type="hidden" name="action" id="action" value="">
<input type="hidden" name="level" id="level" value="">
<input type="hidden" name="checkin_id[]" id="checkin_single" value="">
<div class="table-holder">
<table class="table">
<thead>
<tr>
<th class="col-1"><input id="checkall" type="checkbox" class="check-box" onclick="CheckAll( this.id, 'checkin_id[]' )" /></th>
<th class="col-2"><?php echo Kohana::lang('ui_admin.checkin_details');?></th>
<th class="col-3"><?php echo Kohana::lang('ui_main.date');?></th>
<th class="col-4"><?php echo Kohana::lang('ui_main.actions');?></th>
</tr>
</thead>
<tfoot>
<tr class="foot">
<td colspan="4">
<?php echo $pagination; ?>
</td>
</tr>
</tfoot>
<tbody>
<?php if ($total_items == 0): ?>
<tr>
<td colspan="4" class="col">
<h3><?php echo Kohana::lang('ui_main.no_results');?></h3>
</td>
</tr>
<?php endif; ?>
<?php
}
foreach ($checkins as $checkin):
$checkin_id = $checkin->id;
$incident_id = $checkin->incident_id;
$location = $checkin->location->location_name;
$latitude = $checkin->location->latitude;
$longitude = $checkin->location->longitude;
$description = $checkin->checkin_description;
$preview = text::limit_chars(strip_tags($description), 150, "...", true);

$checkin_date = date('Y-m-d h:i', strtotime($checkin->checkin_date));
$auto_checkin = ($checkin->checkin_auto) ? "YES" : "NO";
?>
<!-- report-table -->
<?php print form::open(NULL, array('id' => 'checkinMain', 'name' => 'checkinMain')); ?>
<input type="hidden" name="action" id="action" value="">
<input type="hidden" name="level" id="level" value="">
<input type="hidden" name="checkin_id[]" id="checkin_single" value="">
<div class="table-holder">
<table class="table">
<thead>
<tr>
<th class="col-1"><input id="checkall" type="checkbox" class="check-box" onclick="CheckAll( this.id, 'checkin_id[]' )" /></th>
<th class="col-2"><?php echo Kohana::lang('ui_admin.checkin_details');?></th>
<th class="col-3"><?php echo Kohana::lang('ui_main.date');?></th>
<th class="col-4"><?php echo Kohana::lang('ui_main.actions');?></th>
</tr>
</thead>
<tfoot>
<tr class="foot">
<td colspan="4">
<?php echo $pagination; ?>
</td>
</tr>
</tfoot>
<tbody>
<tr>
<td class="col-1"><input name="checkin_id[]" id="checkin" value="<?php echo $checkin_id; ?>" type="checkbox" class="check-box"/></td>
<td class="col-2">
<div class="post">
<p><?php echo $preview; ?></p>
<p><a href="javascript:showCheckin('checkin_preview_<?php echo $checkin_id?>', '<?php echo $longitude?>', '<?php echo $latitude?>')"><?php echo Kohana::lang('ui_admin.preview');?></a></p>
<div id="checkin_preview_<?php echo $checkin_id?>" class="preview_div">
<?php echo $description; ?>
<div id="checkin_preview_<?php echo $checkin_id?>_map" class="checkin_map"></div>
<?php
// Retrieve Attachments if any
foreach($checkin->media as $photo)
{
if ($photo->media_type == 1)
{
print "<div class=\"attachment_thumbs\" style=\"margin-top:15px\" id=\"photo_". $photo->id ."\">";

$thumb = $photo->media_thumb;
$photo_link = $photo->media_link;
$prefix = url::base().Kohana::config('upload.relative_directory');
print "<a class='photothumb' rel='lightbox-group".$checkin_id."' href='$prefix/$photo_link'>";
print "<img src=\"$prefix/$thumb\" border=\"0\" >";
print "</a>";
print "</div>";
}
}
?>
<div style="clear:both;"></div>
</div>
</div>
<ul class="info">
<li class="none-separator"><?php echo Kohana::lang('ui_main.location');?>: <strong><?php echo $latitude.", ".$longitude; ?></strong></li>
<li><?php echo Kohana::lang('ui_main.auto_checkin');?>: <strong><?php echo $auto_checkin; ?></strong></li>
</ul>
</td>
<td class="col-3"><?php echo $checkin_date; ?></td>
<td class="col-4">
<ul>
<?php
if ($total_items == 0)
if ((int) $incident_id)
{
?>
<tr>
<td colspan="4" class="col">
<h3><?php echo Kohana::lang('ui_main.no_results');?></h3>
</td>
</tr>
<?php
echo "<li class=\"none-separator\"><a href=\"". url::base() . 'members/reports/edit/' . $incident_id ."\" class=\"status_yes\"><strong>".Kohana::lang('ui_admin.view_report')."</strong></a></li>";
}
foreach ($checkins as $checkin)
else
{
$checkin_id = $checkin->id;
$incident_id = $checkin->incident_id;
$location = $checkin->location->location_name;
$latitude = $checkin->location->latitude;
$longitude = $checkin->location->longitude;
$description = $checkin->checkin_description;
$preview = text::limit_chars(strip_tags($description), 150, "...", true);

$checkin_date = date('Y-m-d h:i', strtotime($checkin->checkin_date));
$auto_checkin = ($checkin->checkin_auto) ? "YES" : "NO";
?>
<tr>
<td class="col-1"><input name="checkin_id[]" id="checkin" value="<?php echo $checkin_id; ?>" type="checkbox" class="check-box"/></td>
<td class="col-2">
<div class="post">
<p><?php echo $preview; ?></p>
<p><a href="javascript:showCheckin('checkin_preview_<?php echo $checkin_id?>', '<?php echo $longitude?>', '<?php echo $latitude?>')"><?php echo Kohana::lang('ui_admin.preview');?></a></p>
<div id="checkin_preview_<?php echo $checkin_id?>" class="preview_div">
<?php echo $description; ?>
<div id="checkin_preview_<?php echo $checkin_id?>_map" class="checkin_map"></div>
<?php
// Retrieve Attachments if any
foreach($checkin->media as $photo)
{
if ($photo->media_type == 1)
{
print "<div class=\"attachment_thumbs\" style=\"margin-top:15px\" id=\"photo_". $photo->id ."\">";

$thumb = $photo->media_thumb;
$photo_link = $photo->media_link;
$prefix = url::base().Kohana::config('upload.relative_directory');
print "<a class='photothumb' rel='lightbox-group".$checkin_id."' href='$prefix/$photo_link'>";
print "<img src=\"$prefix/$thumb\" border=\"0\" >";
print "</a>";
print "</div>";
}
}
?>
<div style="clear:both;"></div>
</div>
</div>
<ul class="info">
<li class="none-separator"><?php echo Kohana::lang('ui_main.location');?>: <strong><?php echo $latitude.", ".$longitude; ?></strong></li>
<li><?php echo Kohana::lang('ui_main.auto_checkin');?>: <strong><?php echo $auto_checkin; ?></strong></li>
</ul>
</td>
<td class="col-3"><?php echo $checkin_date; ?></td>
<td class="col-4">
<ul>
<?php
if ((int) $incident_id)
{
echo "<li class=\"none-separator\"><a href=\"". url::base() . 'members/reports/edit/' . $incident_id ."\" class=\"status_yes\"><strong>".Kohana::lang('ui_admin.view_report')."</strong></a></li>";
}
else
{
echo "<li class=\"none-separator\"><a href=\"". url::base() . 'members/reports/edit?cid=' . $checkin_id ."\">".Kohana::lang('ui_admin.create_report')."?</a></li>";
}
?>
<li class="none-separator"><a href="javascript:checkinAction('d','DELETE','<?php echo(rawurlencode($checkin_id)); ?>')" class="del"><?php echo Kohana::lang('ui_main.delete');?></a></li>
</ul>
</td>
</tr>
<?php
echo "<li class=\"none-separator\"><a href=\"". url::base() . 'members/reports/edit?cid=' . $checkin_id ."\">".Kohana::lang('ui_admin.create_report')."?</a></li>";
}
?>
</tbody>
</table>
</div>
<?php print form::close(); ?>
</div>
<li class="none-separator"><a href="javascript:checkinAction('d','DELETE','<?php echo(rawurlencode($checkin_id)); ?>')" class="del"><?php echo Kohana::lang('ui_main.delete');?></a></li>
</ul>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php print form::close(); ?>
</div>
@@ -1,11 +1,5 @@
<?php require APPPATH.'views/admin/utils_js.php' ?>
var map;
var proj_4326 = new OpenLayers.Projection('EPSG:4326');
var proj_900913 = new OpenLayers.Projection('EPSG:900913');
var latitude;
var longitude;
var markers;
var linestring;

function showCheckin(id, lon, lat) {
if (id) {
@@ -26,56 +20,43 @@ function showCheckin(id, lon, lat) {
}

function showMap(id, lon, lat) {
/*
- Initialize Map
- Uses Spherical Mercator Projection
- Units in Metres instead of Degrees
*/
var options = {
units: "dd",
numZoomLevels: 16,
controls:[],
projection: proj_900913,
'displayProjection': proj_4326,
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
maxResolution: 156543.0339
<?php echo map::layers_js(FALSE); ?>

// Map configuration
var mapConfig = {
// Map center
center: {
latitude: lat,
longitude: lon,
},

// Zoom level
zoom: <?php echo Kohana::config('settings.default_zoom'); ?>,

// Base layers
baseLayers: <?php echo map::layers_array(FALSE); ?>
};

map = new OpenLayers.Map(id + '_map', options);

<?php echo map::layers_js(FALSE); ?>
map.addLayers(<?php echo map::layers_array(FALSE); ?>);

map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.LayerSwitcher());
// Initialize the map
map = new Ushahidi.Map(id + '_map', mapConfig);


style = new OpenLayers.Style({
// Style for the checkin
var style = new OpenLayers.Style({
fillColor: "#<?php echo Kohana::config('settings.default_map_all'); ?>",
fillOpacity: 0.8,
strokeColor: "white",
strokeOpacity: 1,
pointRadius: "8"
});

var vectorLayer = new OpenLayers.Layer.Vector("Checkin", {
styleMap: new OpenLayers.StyleMap({
"default":style,
"select": style
})

// Style map for the checkins
var styleMap = new OpenLayers.StyleMap({
default: style,
select: style
});

var lonlat = new OpenLayers.LonLat(lon, lat);
lonlat.transform(proj_4326, proj_900913);
map.setCenter(lonlat, 14);

point = new OpenLayers.Geometry.Point(lon, lat);
point.transform(proj_4326, proj_900913);
var origFeature = new OpenLayers.Feature.Vector(point);
vectorLayer.addFeatures(origFeature);
map.addLayer(vectorLayer);

// Add the layer
map.addLayer(Ushahidi.DEFAULT, {styleMap: styleMap, detectMapClicks: false});
}

function checkinAction( action, confirmAction, checkin_id )
@@ -20,32 +20,33 @@
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title><?php echo $site_name ?></title>
<?php
echo html::stylesheet(url::file_loc('css').'media/css/admin/all', '', true);
echo html::stylesheet(url::file_loc('css').'media/css/jquery-ui-themeroller', '', true);
echo html::stylesheet(url::file_loc('css').'media/css/admin/all', '', TRUE);
echo html::stylesheet(url::file_loc('css').'media/css/jquery-ui-themeroller', '', TRUE);
echo "<!--[if lt IE 7]>".
html::stylesheet(url::file_loc('css').'media/css/ie6', '', true)
html::stylesheet(url::file_loc('css').'media/css/ie6', '', TRUE)
."<![endif]-->";

// Load OpenLayers
if ($map_enabled)
{
echo html::script(url::file_loc('js').'media/js/OpenLayers', true);
echo html::script(url::file_loc('js').'media/js/OpenLayers', TRUE);
echo $api_url . "\n";
echo "<script type=\"text/javascript\">
OpenLayers.ImgPath = '".url::file_loc('img').'media/img/openlayers/'."';
</script>";
echo html::stylesheet(url::file_loc('css').'media/css/openlayers','',true);
echo html::script(url::file_loc('js').'media/js/ushahidi', TRUE);
echo html::stylesheet(url::file_loc('css').'media/css/openlayers','',TRUE);
}

// Load jQuery
echo html::script(url::file_loc('js').'media/js/jquery', true);
echo html::script(url::file_loc('js').'media/js/jquery.form', true);
echo html::script(url::file_loc('js').'media/js/jquery.validate.min', true);
echo html::script(url::file_loc('js').'media/js/jquery.ui.min', true);
echo html::script(url::file_loc('js').'media/js/selectToUISlider.jQuery', true);
echo html::script(url::file_loc('js').'media/js/jquery.hovertip-1.0', true);
echo html::script(url::file_loc('js').'media/js/jquery.base64', true);
echo html::stylesheet(url::file_loc('css').'media/css/jquery.hovertip-1.0', '', true);
echo html::script(url::file_loc('js').'media/js/jquery', TRUE);
echo html::script(url::file_loc('js').'media/js/jquery.form', TRUE);
echo html::script(url::file_loc('js').'media/js/jquery.validate.min', TRUE);
echo html::script(url::file_loc('js').'media/js/jquery.ui.min', TRUE);
echo html::script(url::file_loc('js').'media/js/selectToUISlider.jQuery', TRUE);
echo html::script(url::file_loc('js').'media/js/jquery.hovertip-1.0', TRUE);
echo html::script(url::file_loc('js').'media/js/jquery.base64', TRUE);
echo html::stylesheet(url::file_loc('css').'media/css/jquery.hovertip-1.0', '', TRUE);

echo "<script type=\"text/javascript\">
$(function() {
@@ -57,9 +58,9 @@
// Load Flot
if ($flot_enabled)
{
echo html::script(url::file_loc('js').'media/js/jquery.flot', true);
echo html::script(url::file_loc('js').'media/js/excanvas.min', true);
echo html::script(url::file_loc('js').'media/js/timeline.js', true);
echo html::script(url::file_loc('js').'media/js/jquery.flot', TRUE);
echo html::script(url::file_loc('js').'media/js/excanvas.min', TRUE);
echo html::script(url::file_loc('js').'media/js/timeline.js', TRUE);
}

// Load TreeView
@@ -72,58 +73,58 @@
if ($protochart_enabled)
{
echo "<script type=\"text/javascript\">jQuery.noConflict()</script>";
echo html::script(url::file_loc('js').'media/js/protochart/prototype', true);
echo html::script(url::file_loc('js').'media/js/protochart/prototype', TRUE);
echo '<!--[if IE]>';
echo html::script(url::file_loc('js').'media/js/protochart/excanvas-compressed', true);
echo html::script(url::file_loc('js').'media/js/protochart/excanvas-compressed', TRUE);
echo '<![endif]-->';
echo html::script(url::file_loc('js').'media/js/protochart/ProtoChart', true);
echo html::script(url::file_loc('js').'media/js/protochart/ProtoChart', TRUE);
}

// Load Raphael
if($raphael_enabled)
{
// The only reason we include prototype is to keep the div element naming convention consistent
//echo html::script(url::file_loc('js').'media/js/protochart/prototype', true);
echo html::script(url::file_loc('js').'media/js/raphael', true);
//echo html::script(url::file_loc('js').'media/js/protochart/prototype', TRUE);
echo html::script(url::file_loc('js').'media/js/raphael', TRUE);
echo '<script type="text/javascript" charset="utf-8">';
echo 'var impact_json = { '.$impact_json .' };';
echo '</script>';
echo html::script(url::file_loc('js').'media/js/raphael-ushahidi-impact', true);
echo html::script(url::file_loc('js').'media/js/raphael-ushahidi-impact', TRUE);
}

// Load ColorPicker
if ($colorpicker_enabled)
{
echo html::stylesheet(url::file_loc('css').'media/css/colorpicker', '', true);
echo html::script(url::file_loc('js').'media/js/colorpicker', true);
echo html::stylesheet(url::file_loc('css').'media/css/colorpicker', '', TRUE);
echo html::script(url::file_loc('js').'media/js/colorpicker', TRUE);
}

// Load TinyMCE
if ($editor_enabled)
{
echo html::script(url::file_loc('js').'media/js/tinymce/tiny_mce', true);
echo html::script(url::file_loc('js').'media/js/tinymce/tiny_mce', TRUE);
}

// JSON2 for IE+
if ($json2_enabled)
{
echo html::script(url::file_loc('js').'media/js/json2', true);
echo html::script(url::file_loc('js').'media/js/json2', TRUE);
}

// Load AutoComplete Plugin
if ($autocomplete_enabled)
{
echo html::stylesheet(url::file_loc('css').'media/css/jquery.autocomplete', '', true);
echo html::script(url::file_loc('js').'media/js/jquery.autocomplete.pack', true);
echo html::stylesheet(url::file_loc('css').'media/css/jquery.autocomplete', '', TRUE);
echo html::script(url::file_loc('js').'media/js/jquery.autocomplete.pack', TRUE);
}

// Turn on picbox
echo html::script(url::file_loc('js').'media/js/picbox', true);
echo html::script(url::file_loc('js').'media/js/picbox', TRUE);
echo html::stylesheet(url::file_loc('css').'media/css/picbox/picbox');

// Header Nav
echo html::script(url::file_loc('js').'media/js/global', true);
echo html::stylesheet(url::file_loc('css').'media/css/global','',true);
echo html::script(url::file_loc('js').'media/js/global', TRUE);
echo html::stylesheet(url::file_loc('css').'media/css/global','',TRUE);

// Render CSS and Javascript Files from Plugins
echo plugin::render('stylesheet');
@@ -151,11 +152,9 @@ function show_addedit(toggle){
}
$("a.add").focus();
}
<?php
if ($form_error) {
echo '$(document).ready(function() { $("#addedit").show(); });';
}
?>
<?php if ($form_error): ?>
$(document).ready(function() { $("#addedit").show(); });
<?php endif; ?>
</script>
</head>
<body>
@@ -180,9 +179,9 @@ function show_addedit(toggle){
<div class="nav-holder">
<!-- main-nav -->
<ul class="main-nav">
<?php foreach($main_tabs as $page => $tab_name){ ?>
<?php foreach($main_tabs as $page => $tab_name): ?>
<li><a href="<?php echo url::site(); ?>members/<?php echo $page; ?>" <?php if($this_page==$page) echo 'class="active"' ;?>><?php echo $tab_name; ?></a></li>
<?php } ?>
<?php endforeach; ?>
</ul>
</div>
</div>
@@ -456,6 +456,9 @@
* the url When the callback is specified, the protocol property
* is omitted from the options passed to the layer constructor. The
* features property is used instead
* detectMapClicks - {Boolean} - When true, registers a callback function to detect
* click events on the map. This option is only used with the default
* layer (Ushahidi.DEFAULT). The default value is true
* transform - {Boolean} When true, transforms the featur geometry to spherical mercator
* The default value is false
*
@@ -476,27 +479,46 @@
} else if (layerType == Ushahidi.DEFAULT) {
this.deleteLayer("default");

var markers = new OpenLayers.Layer.Markers("default");
markers.addMarker(new OpenLayers.Marker(this._olMap.getCenter()));
var markers = null;

// Check for the style map
if (options.styleMap) {

// Create vector layer
markers = new OpenLayers.Layer.Vector("default", {
styleMap: styleMap
});

// Add features to the vector layer
makers.addFeatures(new OpenLayers.Feature.Vector(this._olMap.getCenter()));

} else {
markers = new OpenLayers.Layer.Markers("default");
markers.addMarker(new OpenLayers.Marker(this._olMap.getCenter()));
}

// Add the layer to the map
this._olMap.addLayer(markers);
var context = this;

context._olMap.events.register("click", context._olMap, function(e){
var point = context._olMap.getLonLatFromViewPortPx(e.xy);
markers.clearMarkers();
markers.addMarker(new OpenLayers.Marker(point));

point.transform(Ushahidi.proj_900913, Ushahidi.proj_4326);

var coords = {latitude: point.lat, longitude: point.lon};
context.trigger("markerpositionchanged", coords);

// Update the current map center
var newCenter = new OpenLayers.LonLat(coords.longitude, coords.latitude);
newCenter.transform(Ushahidi.proj_4326, Ushahidi.proj_900913);
context._currentCenter = newCenter;
});

// Is map-click detection enabled?
if (options.detectMapClicks == undefined || options.detectMapClicks) {
var context = this;
context._olMap.events.register("click", context._olMap, function(e){
var point = context._olMap.getLonLatFromViewPortPx(e.xy);
markers.clearMarkers();
markers.addMarker(new OpenLayers.Marker(point));

point.transform(Ushahidi.proj_900913, Ushahidi.proj_4326);

var coords = {latitude: point.lat, longitude: point.lon};
context.trigger("markerpositionchanged", coords);

// Update the current map center
var newCenter = new OpenLayers.LonLat(coords.longitude, coords.latitude);
newCenter.transform(Ushahidi.proj_4326, Ushahidi.proj_900913);
context._currentCenter = newCenter;
});
}

this._isLoaded = 1;

@@ -2,4 +2,4 @@
UPDATE `settings` SET `value` = 95 WHERE `key` = 'db_version';

-- UPDATE ushahidi_version
UPDATE `settings` SET value = '2.5b' WHERE `key` = 'ushahidi_version';
UPDATE `settings` SET `value` = '2.5b' WHERE `key` = 'ushahidi_version';
@@ -17,6 +17,9 @@

// Map reference
var map = null;
var latitude = <?php echo Kohana::config('settings.default_lat') ?>;
var longitude = <?php echo Kohana::config('settings.default_lon'); ?>;
var zoom = <?php echo Kohana::config('settings.default_zoom'); ?>;

jQuery(function($) {
$(window).load(function(){
@@ -30,21 +33,21 @@

// Map center
center: {
latitude: <?php echo $latitude; ?>,
longitude: <?php echo $longitude; ?>,
latitude: latitude,
longitude: longitude,
},

// Zoom level
zoom: <?php echo $default_zoom; ?>,
zoom: zoom,

// Base layers
baseLayers: <?php echo map::layers_array(FALSE); ?>
};

map = new Ushahidi.Map('divMap', mapConfig);
map.addRadiusLayer({
latitude: <?php echo $latitude; ?>,
longitude: <?php echo $longitude; ?>
latitude: latitude,
longitude: longitude
});

// Subscribe to makerpositionchanged event
@@ -111,8 +111,7 @@
? $selected_categories = $form['incident_category']
: array();

$columns = 2;
echo category::tree($categories, TRUE, $selected_categories, 'incident_category', $columns);
echo category::tree($categories, TRUE, $selected_categories, 'incident_category', 2);
?>
</div>
</div>