diff --git a/extras/pandroid_event_viewer/AndroidManifest.xml b/extras/pandroid_event_viewer/AndroidManifest.xml
index 3d8cc33b41..f2315e7285 100644
--- a/extras/pandroid_event_viewer/AndroidManifest.xml
+++ b/extras/pandroid_event_viewer/AndroidManifest.xml
@@ -18,7 +18,7 @@
package="pandroid_event_viewer.pandorafms"
android:versionCode="1"
android:versionName="1.0">
-
+
- Main
+ Filter
Event list
main text (value english)
@@ -48,7 +48,7 @@
Load more events
Empty list events
Refresh time watcher
- Set as filter for watcher
+ Filter by default
Update configuration successful.
Update configuration is failed.
@@ -78,4 +78,15 @@
Licensed under GPL
Develop team: Miguel de Dios
+
+ Alert recovered
+ Alert manually validated
+ Going from critical to warning
+ Going down to critical state
+ Going up to normal state
+ Going down from normal to warning
+ Alert fired
+ Recon server detected a new host
+ New agent created
+ Unknown type:
diff --git a/extras/pandroid_event_viewer/res/values-es/strings.xml b/extras/pandroid_event_viewer/res/values-es/strings.xml
index f1297614f0..4877efcf47 100644
--- a/extras/pandroid_event_viewer/res/values-es/strings.xml
+++ b/extras/pandroid_event_viewer/res/values-es/strings.xml
@@ -15,7 +15,7 @@
// GNU General Public License for more details.
-->
- Principal
+ Filtro
Lista de eventos
main text (value spanish)
@@ -48,7 +48,7 @@
Cargar mas eventos
Lista vacia de eventos
Refresco scanner eventos
- Hacerlo filtro para scanner eventos
+ Filtro por defecto
Validar Evento
Configuración guardada correctamente.
@@ -78,4 +78,15 @@
Licenciado bajo GPL
Equipo de desarrollo: Miguel de Dios
+
+ Alerta recuperada
+ Alerta validada manualmente
+ Cayendo de crítico a advertencia
+ Cayendo a estado crítico
+ Subiendo a estado normal
+ Cayendo de normal a advertencia
+ Alerta lanzada
+ El servidor Recon detectó un equipo nuevo
+ Agente nuevo creado
+ Tipo desconocido:
diff --git a/extras/pandroid_event_viewer/res/values/strings.xml b/extras/pandroid_event_viewer/res/values/strings.xml
index e9d014a088..97ff167a59 100644
--- a/extras/pandroid_event_viewer/res/values/strings.xml
+++ b/extras/pandroid_event_viewer/res/values/strings.xml
@@ -20,7 +20,7 @@
PANDROID_EVENT_VIEWER_PREFERENCES
- Main
+ Filter
Event list
main text (value)
@@ -53,7 +53,7 @@
Load more events
Empty list events
Refresh time watcher
- Set as filter for watcher
+ Filter by default
Validate Event
Update configuration successful.
@@ -83,4 +83,15 @@
Licensed under GPL
Develop team: Miguel de Dios
+
+ Alert recovered
+ Alert manually validated
+ Going from critical to warning
+ Going down to critical state
+ Going up to normal state
+ Going down from normal to warning
+ Alert fired
+ Recon server detected a new host
+ New agent created
+ Unknown type:
diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/EventList.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/EventList.java
index 01b1133100..ec550fd231 100644
--- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/EventList.java
+++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/EventList.java
@@ -5,6 +5,7 @@ import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.HashMap;
import android.app.Activity;
@@ -85,6 +86,19 @@ public class EventList extends ListActivity {
int load_more = intent.getIntExtra("load_more", 0);
Log.e("load_more", "" + load_more);
+ Button button = (Button) findViewById(R.id.button_load_more_events);
+ Log.e("object.eventList.size", object.eventList.size() + "");
+ Log.e("object.count_events", object.count_events + "");
+ if (object.eventList.size() == 0) {
+ button.setVisibility(Button.GONE);
+ }
+ else if (((long)object.eventList.size()) >= object.count_events) {
+ button.setVisibility(Button.GONE);
+ }
+ else {
+ button.setVisibility(Button.VISIBLE);
+ }
+
if (load_more == 1) {
la.showLoadingEvents = false;
la.notifyDataSetChanged();
@@ -145,6 +159,7 @@ public class EventList extends ListActivity {
Log.e("onOptionsItemSelected","refresh_button_menu_options");
this.object.loadInProgress = true;
this.object.getNewListEvents = true;
+ this.object.eventList = new ArrayList();
this.toggleLoadingLayout();
this.object.executeBackgroundGetEvents();
break;
@@ -352,7 +367,16 @@ public class EventList extends ListActivity {
}
else {
Button button = (Button)view.findViewById(R.id.button_load_more_events);
- button.setVisibility(Button.VISIBLE);
+
+ if (object.eventList.size() == 0) {
+ button.setVisibility(Button.GONE);
+ }
+ else if (((long)object.eventList.size()) >= object.count_events) {
+ button.setVisibility(Button.GONE);
+ }
+ else {
+ button.setVisibility(Button.VISIBLE);
+ }
button.setOnClickListener(new View.OnClickListener() {
@Override
@@ -438,20 +462,19 @@ public class EventList extends ListActivity {
row.setVisibility(View.VISIBLE);
text = (TextView)viewEventExtended.findViewById(R.id.agent_text);
- //http://127.0.0.1/pandora_console/mobile/index.php?page=agent&id=1
- //Log.e("url", this.object.url);
text.setText(Html.fromHtml(
"" + item.agent_name + ""));
text.setMovementMethod(LinkMovementMethod.getInstance());
- //text.setText(item.agent_name);
-
- setImageType(viewEventExtended, item.description_image, R.id.img_type);
}
+ setImageType(viewEventExtended, item.description_image, R.id.img_type);
+ text = (TextView)viewEventExtended.findViewById(R.id.type_text);
+ text.setText(eventType2Text(item.event_type));
+
if (item.criticity_name.length() != 0) {
text = (TextView)viewEventExtended.findViewById(R.id.severity_text);
text.setText(item.criticity_name);
@@ -479,6 +502,52 @@ public class EventList extends ListActivity {
return view;
}
+ private String eventType2Text(String type) {
+ String return_var;
+
+ if (type.equals("alert_recovered")) {
+ return_var = getApplicationContext().getString(R.string.alert_recovered_str);
+ }
+ else if (type.equals("alert_manual_validation")) {
+ return_var = getApplicationContext().getString(R.string.alert_manual_validation_str);
+ }
+ else if (type.equals("going_up_warning")) {
+ return_var = getApplicationContext().getString(R.string.going_up_warning_str);
+ }
+ else if (type.equals("going_down_critical")) {
+ return_var = getApplicationContext().getString(R.string.going_down_critical_str);
+ }
+ else if (type.equals("going_up_critical")) {
+ return_var = getApplicationContext().getString(R.string.going_down_critical_str);
+ }
+ else if (type.equals("going_up_normal")) {
+ return_var = getApplicationContext().getString(R.string.going_up_normal_str);
+ }
+ else if (type.equals("going_down_normal")) {
+ return_var = getApplicationContext().getString(R.string.going_up_normal_str);
+ }
+ else if (type.equals("going_down_warning")) {
+ return_var = getApplicationContext().getString(R.string.going_down_warning_str);
+ }
+ else if (type.equals("alert_fired")) {
+ return_var = getApplicationContext().getString(R.string.alert_fired_str);
+ }
+ else if (type.equals("system")) {
+ return_var = getApplicationContext().getString(R.string.system_str);
+ }
+ else if (type.equals("recon_host_detected")) {
+ return_var = getApplicationContext().getString(R.string.system_str);
+ }
+ else if (type.equals("new_agent")) {
+ return_var = getApplicationContext().getString(R.string.new_agent_str);
+ }
+ else {
+ return_var = getApplicationContext().getString(R.string.unknown_str) + " " + type;
+ }
+
+ return return_var;
+ }
+
private class OnItemClickListener implements OnClickListener{
private int mPosition;
private PandroidEventviewerActivity object;
diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Main.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Main.java
index b15e039088..796e81cced 100644
--- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Main.java
+++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/Main.java
@@ -165,7 +165,7 @@ public class Main extends Activity {
}
}
catch (Exception e) {
- Log.e("ERROR THE ", e.getMessage());
+ Log.e("ERROR getGroups ", e.getMessage());
}
return array;
@@ -236,6 +236,7 @@ public class Main extends Activity {
public void search_form() {
//Clean the EventList
this.object.eventList = new ArrayList();
+ Log.e("search_form", "" +this.object.eventList.size());
this.object.loadInProgress = true;
//Get form data
diff --git a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java
index 0b5fc37751..cb45bbf63b 100644
--- a/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java
+++ b/extras/pandroid_event_viewer/src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java
@@ -87,7 +87,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
this.offset = 0;
this.agentNameStr = preferences.getString("filterAgentName", "");
this.severity = preferences.getInt("filterSeverity", -1);
- this.status = preferences.getInt("filterStatus", 4);
+ this.status = preferences.getInt("filterStatus", 3);
this.eventSearch = preferences.getString("filterEventSearch", "");
this.filterLastTime = preferences.getInt("filterLastTime", 6);
@@ -299,6 +299,12 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
for (int i= 0; i < lines.length; i++) {
String[] items = lines[i].split(";", 21);
+ if (items.length != 21) {
+ this.count_events --; //Discount invalid.
+ if (this.count_events < 0) this.count_events = 0;
+ continue;
+ }
+
EventListItem event = new EventListItem();
if (items[0].length() == 0) {
event.id_event = 0;