Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions event_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function event_controller()
$message = get('message');

$event->add($userid,$eventfeed,$eventtype,$eventvalue,$action,$setfeed,$setemail,$setvalue,$callcurl,$message,$mutetime,$priority);
$result = "Event added";
$result = _("Event added");
}
if ($route->action == 'edit' && $session['write'])
{
Expand All @@ -57,30 +57,30 @@ function event_controller()
$message = get('message');

$event->update($userid,$eventid,$eventfeed,$eventtype,$eventvalue,$action,$setfeed,$setemail,$setvalue,$callcurl,$message,$mutetime,$priority);
$result = "Event updated";
$result = _("Event updated");
}


else if ($route->action == 'delete' && $session['write'])
{
$id = intval(get('id'));
$event->delete($userid,$id);
$result = "Event deleted";
$result = _("Event deleted");
}
else if ($route->action == 'status' && $session['write'])
{
$id = intval(get('id'));
$status = intval(get('status'));
$event->set_status($userid,$id,$status);
$result = "Event deleted";
$result = _("Event deleted");
}

else if ($route->action == 'test' && $session['write'])
{
$id = intval(get('id'));
$feedid = intval(get('feedid'));
$event->test($userid,$id,$feedid);
$result = "Event Test Sent";
$result = _("Event Test Sent");
}

else if ($route->action == 'settings' && $session['write'])
Expand Down
128 changes: 64 additions & 64 deletions event_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@

<?php global $path, $feed; ?>

<div style="float:right;"><a href="<?php echo $path; ?>event/settings">Event Settings</a></div>
<h2>Event</h2>
<div style="float:right;"><a href="<?php echo $path; ?>event/settings"><?php echo _('Event Settings'); ?></a></div>
<h2><?php echo _('Event'); ?></h2>

<p>Setup actions to occur when a feed goes above, below or is equal to a specified value, or becomes inactive. Send an email or set another feed to a specified value.</p>
<p><?php echo _('Setup actions to occur when a feed goes above, below or is equal to a specified value, or becomes inactive. Send an email or set another feed to a specified value.'); ?></p>

<?php if (!$event_list) { ?>
<div class="alert alert-block">
<h4 class="alert-heading">No event notifications created</h4>
<p>To add an event based notification:</p>
<p>1) Select the feed you wish to be notified about from the drop down menu</p>
<p>2) Select whether you want to be notifed if the feed goes above, below or equals the value specified, or is inactive.</p>
<p>3) Enter a value</p>
<h4 class="alert-heading"><?php echo _('No event notifications created'); ?></h4>
<p><?php echo _('To add an event based notification:'); ?></p>
<p><?php echo _('1) Select the feed you wish to be notified about from the drop down menu'); ?></p>
<p><?php echo _('2) Select whether you want to be notifed if the feed goes above, below or equals the value specified, or is inactive.'); ?></p>
<p><?php echo _('3) Enter a value'); ?></p>
</div>
<?php } else { ?>
<table class="table table-hover" style="">
Expand All @@ -43,11 +43,11 @@
if ($item['eventtype']==0) echo ">";
if ($item['eventtype']==1) echo "<";
if ($item['eventtype']==2) echo "==";
if ($item['eventtype']==3) echo "inactive";
if ($item['eventtype']==4) echo "updated";
if ($item['eventtype']==5) echo "inc by";
if ($item['eventtype']==6) echo "dec by";
if ($item['eventtype']==7) echo "manual update";
if ($item['eventtype']==3) echo _("inactive");
if ($item['eventtype']==4) echo _("updated");
if ($item['eventtype']==5) echo _("inc by");
if ($item['eventtype']==6) echo _("dec by");
if ($item['eventtype']==7) echo _("manual update");
?></td>
<td><?php echo $item['eventvalue']; ?></td>
<td>
Expand All @@ -74,12 +74,12 @@
<td>

<?php
if ($item['action']==0) echo "email";
if ($item['action']==1) echo "feed";
if ($item['action']==2) echo "curl";
if ($item['action']==3) echo "tweet";
if ($item['action']==4) echo "prowl";
if ($item['action']==5) echo "nma";
if ($item['action']==0) echo _("email");
if ($item['action']==1) echo _("feed");
if ($item['action']==2) echo _("curl");
if ($item['action']==3) echo _("tweet");
if ($item['action']==4) echo _("prowl");
if ($item['action']==5) echo _("nma");
?></td>

<td><?php if ($item['action']==1) echo $feed->get_field($item['setfeed'],'name'); ?></td>
Expand All @@ -88,7 +88,7 @@

<td><?php if ($item['action']==2) echo $item['callcurl']; ?></td>
<td><?php echo $item['message']; ?> </td>
<td><?php echo $item['mutetime']; ?> secs</td>
<td><?php echo $item['mutetime']; ?> <?php echo _('secs'); ?></td>
<td><div class="editevent btn"
eventid="<?php echo $item['id']; ?>"
eventtype="<?php echo $item['eventtype']; ?>"
Expand All @@ -102,19 +102,19 @@
message="<?php echo $item['message']; ?>"
mutetime="<?php echo $item['mutetime']; ?>"

>Edit</div></td>
><?php echo _('Edit'); ?></div></td>

<td><div class="deleteevent btn" eventid="<?php echo $item['id']; ?>" >Delete</div></td>
<td><div class="deleteevent btn" eventid="<?php echo $item['id']; ?>" ><?php echo _('Delete'); ?></div></td>
<?php
if($item['disabled'] != 1){ ?>
<td><div class="disableevent btn" eventid="<?php echo $item['id']; ?>" feedid="<?php echo $item['eventfeed']; ?>" >Disable</div></td>
<td><div class="disableevent btn" eventid="<?php echo $item['id']; ?>" feedid="<?php echo $item['eventfeed']; ?>" ><?php echo _('Disable'); ?></div></td>
<?php
}else{ ?>
<td><div class="enableevent btn" eventid="<?php echo $item['id']; ?>" feedid="<?php echo $item['eventfeed']; ?>" >Enable</div></td>
<td><div class="enableevent btn" eventid="<?php echo $item['id']; ?>" feedid="<?php echo $item['eventfeed']; ?>" ><?php echo _('Enable'); ?></div></td>

<?php
} ?>
<td><div class="testevent btn" eventid="<?php echo $item['id']; ?>" feedid="<?php echo $item['eventfeed']; ?>" >Test</div></td>
<td><div class="testevent btn" eventid="<?php echo $item['id']; ?>" feedid="<?php echo $item['eventfeed']; ?>" ><?php echo _('Test'); ?></div></td>
</tr>
<?php } ?>
</table>
Expand All @@ -125,24 +125,24 @@
<form id="eventform" action="event/add" method="get" onsubmit="return false;">
<div style=" background-color:#eee; margin-bottom:10px; border: 1px solid #ddd">
<div style="padding:10px; border-top: 1px solid #fff; ">
<div style="float:left; padding-top:2px; font-weight:bold;">IF</div>
<div style="float:left; padding-top:2px; font-weight:bold;"><?php echo _('IF'); ?></div>

<div style="float:right;">
<select id="eventfeed" name="eventfeed" style="width:160px; margin:0px;">
<?php foreach ($feeds as $feed){ ?>
<option value="<?php echo $feed['id']; ?>"><?php echo $feed['name']; ?></option>
<?php } ?>
</select>
<span style="font-weight:bold;" >is</span>
<span style="font-weight:bold;" ><?php echo _('is'); ?></span>
<select id="eventtype" name="eventtype" style="width:100px; margin:0px;">
<option value="0" >more than</option>
<option value="5" >increases by</option>
<option value="1" >less than</option>
<option value="6" >reduces by</option>
<option value="2" >equal to</option>
<option value="3" >inactive</option>
<option value="4" >is updated</option>
<option value="7" >manual update</option>
<option value="0" ><?php echo _('more than'); ?></option>
<option value="5" ><?php echo _('increases by'); ?></option>
<option value="1" ><?php echo _('less than'); ?></option>
<option value="6" ><?php echo _('reduces by'); ?></option>
<option value="2" ><?php echo _('equal to'); ?></option>
<option value="3" ><?php echo _('inactive'); ?></option>
<option value="4" ><?php echo _('is updated'); ?></option>
<option value="7" ><?php echo _('manual update'); ?></option>
</select>
<input id="eventid" name="eventid" type="text" hidden="true" style="display:none" />
<span id="not-inactive">
Expand All @@ -152,12 +152,12 @@
<span style="font-weight:bold;" >: </span>

<select id="action" name="action" style="width:100px; margin:0px;">
<option value="0" >send email</option>
<option value="1" >set feed</option>
<option value="2" >call url</option>
<option value="3" >tweet</option>
<option value="4" >send prowl</option>
<option value="5" >send nma</option>
<option value="0" ><?php echo _('send email'); ?></option>
<option value="1" ><?php echo _('set feed'); ?></option>
<option value="2" ><?php echo _('call url'); ?></option>
<option value="3" ><?php echo _('tweet'); ?></option>
<option value="4" ><?php echo _('send prowl'); ?></option>
<option value="5" ><?php echo _('send nma'); ?></option>
</select>

<span id="not-email" style="display:none">
Expand All @@ -172,21 +172,21 @@
</select>
</span>

<span id="not-value" style="font-weight:bold;" >to
<span id="not-value" style="font-weight:bold;" ><?php echo _('to'); ?>
<input id="setvalue" name="setvalue" type="text" style="width:60px; margin:0px;" />
</span>

<span id="not-message" style="font-weight:bold;" > message
<span id="not-message" style="font-weight:bold;" > <?php echo _('message'); ?>
<input id="message" name="message" type="text" style="width:180px; margin:0px;" value="Feed is {value}"/>
</span>

<span id="not-priority" style="font-weight:bold;" > priority
<span id="not-priority" style="font-weight:bold;" > <?php echo _('priority'); ?>
<select id="action-priority" name="priority" style="width:100px; margin:0px;">
<option value="-2">Very Low</option>
<option value="-1">Moderate</option>
<option value="0">Normal</option>
<option value="1">High</option>
<option value="2">Emergency</option>
<option value="-2"><?php echo _('Very Low'); ?></option>
<option value="-1"><?php echo _('Moderate'); ?></option>
<option value="0"><?php echo _('Normal'); ?></option>
<option value="1"><?php echo _('High'); ?></option>
<option value="2"><?php echo _('Emergency'); ?></option>
</select>
</span>

Expand All @@ -196,23 +196,23 @@
</span>

<select id="mutetime" name="mutetime" style="width:100px; margin:0px;">
<option value="0">No mute</option>
<option value="5">5 secs</option>
<option value="15">15 secs</option>
<option value="30">30 secs</option>
<option value="60">1 min</option>
<option value="300">5 min</option>
<option value="600">10 min</option>
<option value="1800">30 min</option>
<option value="3600">1 hour</option>
<option value="14400">3 hour</option>
<option value="28800">6 hour</option>
<option value="57600">12 hour</option>
<option value="86400">24 hour</option>
<option value="0"><?php echo _('No mute'); ?></option>
<option value="5"><?php echo _('5 secs'); ?></option>
<option value="15"><?php echo _('15 secs'); ?></option>
<option value="30"><?php echo _('30 secs'); ?></option>
<option value="60"><?php echo _('1 min'); ?></option>
<option value="300"><?php echo _('5 min'); ?></option>
<option value="600"><?php echo _('10 min'); ?></option>
<option value="1800"><?php echo _('30 min'); ?></option>
<option value="3600"><?php echo _('1 hour'); ?></option>
<option value="14400"><?php echo _('3 hour'); ?></option>
<option value="28800"><?php echo _('6 hour'); ?></option>
<option value="57600"><?php echo _('12 hour'); ?></option>
<option value="86400"><?php echo _('24 hour'); ?></option>
</select>

<div id="addevent" class="btn btn-info" >Add</div>
<div id="editeventbtn" class="btn btn-info" >Edit</div>
<div id="addevent" class="btn btn-info" ><?php echo _('Add'); ?></div>
<div id="editeventbtn" class="btn btn-info" ><?php echo _('Edit'); ?></div>
</div>
<div style="clear:both"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion event_menu.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

$menu_dropdown[] = array('name'=>"Event", 'path'=>"event" , 'session'=>"write", 'order' => 10 );
$menu_dropdown[] = array('name'=> _("Event"), 'path'=>"event" , 'session'=>"write", 'order' => 10 );
12 changes: 6 additions & 6 deletions event_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ public function check_feed_event($feedid,$updatetime,$feedtime,$value,$row=NULL,
$message = str_replace('{feed}', $feedData->name, $message);
$message = str_replace('{value}', $value, $message);
$message = htmlspecialchars($message);
if (empty($message)) { $message = "No message body"; }
if (empty($message)) { $message = _("No message body"); }

if($test){
$message = 'TEST - '.$message;
$message = _('TEST - ').$message;
}

// event type
Expand Down Expand Up @@ -313,11 +313,11 @@ public function check_feed_event($feedid,$updatetime,$feedtime,$value,$row=NULL,

// grab URL and pass it to the browser
if(curl_exec($ch) === false){
error_log("Curl Error:".curl_error($ch));
error_log(_("Curl Error:").curl_error($ch));
}
// close cURL resource, and free up system resources
curl_close($ch);
error_log("Curl Log:".$body);
error_log(_("Curl Log:").$body);


break;
Expand Down Expand Up @@ -345,7 +345,7 @@ public function check_feed_event($feedid,$updatetime,$feedtime,$value,$row=NULL,
$writeconnection->url('1/statuses/update'), array('status' => $message));

if ($writeconnection->response['code'] != 200) {
error_log("Twitter error:".$writeconnection->pr(htmlentities($writeconnection->response['response'])));
error_log(_("Twitter error:").$writeconnection->pr(htmlentities($writeconnection->response['response'])));
}
break;
case 4:
Expand All @@ -367,7 +367,7 @@ public function check_feed_event($feedid,$updatetime,$feedtime,$value,$row=NULL,


// These are optional:
$message = 'event at '.date("Y-m-d H:i:s",time());
$message = _('event at ').date("Y-m-d H:i:s",time());
$oMsg->setDescription($message);
$oMsg->setApplication('emoncms');

Expand Down
6 changes: 3 additions & 3 deletions event_settings_view.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<?php global $user,$session; ?>

<h2>Event settings</h2>
<h2><?php echo _('Event settings'); ?></h2>

<form action="savesettings" method="post">

Expand All @@ -27,8 +27,8 @@
<br>

<select name="smtpport">
<option <?php if ($settings['smtpport'] == '25') { echo "selected"; }?> value="25">25 (No SSL)</option>
<option <?php if ($settings['smtpport'] == '465') { echo "selected"; }?> value="465">465 (SSL)</option>
<option <?php if ($settings['smtpport'] == '25') { echo "selected"; }?> value="25"><?php echo _('25 (No SSL)'); ?></option>
<option <?php if ($settings['smtpport'] == '465') { echo "selected"; }?> value="465"><?php echo _('465 (SSL)'); ?></option>
</select>
<br>

Expand Down
Binary file added locale/en_EN/LC_MESSAGES/messages.mo
Binary file not shown.
Loading