mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
2011-10-04 Miguel de Dios <miguel.dedios@artica.es>
* res/values/arrays.xml, res/values-en/arrays.xml, res/values-es/arrays.xml: disabled the element search "all events" for the actual version Pandora API. * src/pandroid_event_viewer/pandorafms/AlarmReceiver.java, src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java, src/pandroid_event_viewer/pandorafms/Main.java, src/pandroid_event_viewer/pandorafms/EventList.java: wip and fixes. * res/layout/item_list_event_extended.xml: added the style to comments for avoid overflow in the width dimension. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5040 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
49a8cd47a3
commit
67b703a844
@ -1,3 +1,16 @@
|
|||||||
|
2011-10-04 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
* res/values/arrays.xml, res/values-en/arrays.xml,
|
||||||
|
res/values-es/arrays.xml: disabled the element search "all events" for the
|
||||||
|
actual version Pandora API.
|
||||||
|
|
||||||
|
* src/pandroid_event_viewer/pandorafms/AlarmReceiver.java,
|
||||||
|
src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java,
|
||||||
|
src/pandroid_event_viewer/pandorafms/Main.java,
|
||||||
|
src/pandroid_event_viewer/pandorafms/EventList.java: wip and fixes.
|
||||||
|
|
||||||
|
* res/layout/item_list_event_extended.xml: added the style to comments for
|
||||||
|
avoid overflow in the width dimension.
|
||||||
|
|
||||||
2011-10-04 Miguel de Dios <miguel.dedios@artica.es>
|
2011-10-04 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java
|
* src/pandroid_event_viewer/pandorafms/PandroidEventviewerActivity.java
|
||||||
|
@ -131,7 +131,10 @@
|
|||||||
android:text="1"
|
android:text="1"
|
||||||
/>
|
/>
|
||||||
</TableRow>-->
|
</TableRow>-->
|
||||||
<TableRow>
|
<TableRow
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
>
|
||||||
<TextView
|
<TextView
|
||||||
android:textColor="#000"
|
android:textColor="#000"
|
||||||
android:text="@string/comments_label_str"
|
android:text="@string/comments_label_str"
|
||||||
@ -141,6 +144,8 @@
|
|||||||
android:id="@+id/comments_text"
|
android:id="@+id/comments_text"
|
||||||
android:textColor="#000"
|
android:textColor="#000"
|
||||||
android:text="- Empty -"
|
android:text="- Empty -"
|
||||||
|
android:singleLine="false"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
|
@ -50,7 +50,9 @@
|
|||||||
|
|
||||||
<string-array name="event_status_values">
|
<string-array name="event_status_values">
|
||||||
<!-- You must subtract -1 -->
|
<!-- You must subtract -1 -->
|
||||||
<item>All event</item>
|
<!--<item>All event</item>//The next version re-add please -->
|
||||||
|
|
||||||
|
<!-- You must subtract -2 -->
|
||||||
<item>Only new</item>
|
<item>Only new</item>
|
||||||
<item>Only validated</item>
|
<item>Only validated</item>
|
||||||
<item>Only in process</item>
|
<item>Only in process</item>
|
||||||
|
@ -50,7 +50,9 @@
|
|||||||
|
|
||||||
<string-array name="event_status_values">
|
<string-array name="event_status_values">
|
||||||
<!-- You must subtract -1 -->
|
<!-- You must subtract -1 -->
|
||||||
<item>Todo los eventos</item>
|
<!--<item>Todo los eventos</item> //The next version re-add please -->
|
||||||
|
|
||||||
|
<!-- You must subtract -2 -->
|
||||||
<item>Solo los nuevos</item>
|
<item>Solo los nuevos</item>
|
||||||
<item>Solo los validados</item>
|
<item>Solo los validados</item>
|
||||||
<item>Solo los en proceso</item>
|
<item>Solo los en proceso</item>
|
||||||
|
@ -50,7 +50,9 @@
|
|||||||
|
|
||||||
<string-array name="event_status_values">
|
<string-array name="event_status_values">
|
||||||
<!-- You must subtract -1 -->
|
<!-- You must subtract -1 -->
|
||||||
<item>All event</item>
|
<!--<item>All event</item>//The next version re-add please -->
|
||||||
|
|
||||||
|
<!-- You must subtract -2 -->
|
||||||
<item>Only new</item>
|
<item>Only new</item>
|
||||||
<item>Only validated</item>
|
<item>Only validated</item>
|
||||||
<item>Only in process</item>
|
<item>Only in process</item>
|
||||||
|
@ -45,6 +45,9 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||||||
this.url = preferences.getString("url", "");
|
this.url = preferences.getString("url", "");
|
||||||
this.user = preferences.getString("user", "");
|
this.user = preferences.getString("user", "");
|
||||||
this.password = preferences.getString("password", "");
|
this.password = preferences.getString("password", "");
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
long now = (c.getTimeInMillis() / 1000);
|
||||||
|
long old_previous_filterTimestamp = preferences.getLong("previous_filterTimestamp", now);
|
||||||
|
|
||||||
if ((user.length() == 0) && (password.length() == 0)
|
if ((user.length() == 0) && (password.length() == 0)
|
||||||
&& (url.length() == 0)) {
|
&& (url.length() == 0)) {
|
||||||
@ -105,6 +108,11 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.more_criticity = -1;
|
this.more_criticity = -1;
|
||||||
|
|
||||||
|
//Restore timestamp
|
||||||
|
SharedPreferences.Editor editorPreferences = preferences.edit();
|
||||||
|
editorPreferences.putLong("previous_filterTimestamp", old_previous_filterTimestamp);
|
||||||
|
editorPreferences.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -125,7 +133,7 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||||||
String filterAgentName = preferences.getString("filterAgentName", "");
|
String filterAgentName = preferences.getString("filterAgentName", "");
|
||||||
int filterIDGroup = preferences.getInt("filterIDGroup", 0);
|
int filterIDGroup = preferences.getInt("filterIDGroup", 0);
|
||||||
int filterSeverity = preferences.getInt("filterSeverity", -1);
|
int filterSeverity = preferences.getInt("filterSeverity", -1);
|
||||||
int filterStatus = preferences.getInt("filterStatus", 4);
|
int filterStatus = preferences.getInt("filterStatus", 3);
|
||||||
String filterEventSearch = preferences.getString("filterEventSearch", "");
|
String filterEventSearch = preferences.getString("filterEventSearch", "");
|
||||||
|
|
||||||
|
|
||||||
@ -135,7 +143,12 @@ public class AlarmReceiver extends BroadcastReceiver {
|
|||||||
SharedPreferences.Editor editorPreferences = preferences.edit();
|
SharedPreferences.Editor editorPreferences = preferences.edit();
|
||||||
editorPreferences.putLong("filterTimestamp", now); //Save for the next execution.
|
editorPreferences.putLong("filterTimestamp", now); //Save for the next execution.
|
||||||
editorPreferences.putLong("previous_filterTimestamp", filterTimestamp); //Save and the previous for the list.
|
editorPreferences.putLong("previous_filterTimestamp", filterTimestamp); //Save and the previous for the list.
|
||||||
editorPreferences.commit();
|
if (editorPreferences.commit()) {
|
||||||
|
Log.e("AlarmReceiver serializeParams2Api", "YES COMMIT");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log.e("AlarmReceiver serializeParams2Api", "NOT COMMIT");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String return_var = "";
|
String return_var = "";
|
||||||
|
@ -507,6 +507,9 @@ public class EventList extends ListActivity {
|
|||||||
setImageType(viewEventExtended, item.criticity_image, R.id.img_severity);
|
setImageType(viewEventExtended, item.criticity_image, R.id.img_severity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Set the open and close the extended info event row action.
|
||||||
|
view.setOnClickListener(new OnItemClickListener(position, this.object));
|
||||||
|
|
||||||
Button button;
|
Button button;
|
||||||
button = (Button)viewEventExtended.findViewById(R.id.validate_button_extended);
|
button = (Button)viewEventExtended.findViewById(R.id.validate_button_extended);
|
||||||
if (item.status == -1) {
|
if (item.status == -1) {
|
||||||
@ -521,7 +524,6 @@ public class EventList extends ListActivity {
|
|||||||
clickListener.id_event = item.id_event;
|
clickListener.id_event = item.id_event;
|
||||||
clickListener.core = this.core;
|
clickListener.core = this.core;
|
||||||
button.setOnClickListener(clickListener);
|
button.setOnClickListener(clickListener);
|
||||||
view.setOnClickListener(new OnItemClickListener(position, this.object));
|
|
||||||
|
|
||||||
text = (TextView)viewEventExtended.findViewById(R.id.validate_event_label);
|
text = (TextView)viewEventExtended.findViewById(R.id.validate_event_label);
|
||||||
text.setVisibility(TextView.GONE);
|
text.setVisibility(TextView.GONE);
|
||||||
|
@ -92,7 +92,7 @@ public class Main extends Activity {
|
|||||||
this, R.array.event_status_values, android.R.layout.simple_spinner_item);
|
this, R.array.event_status_values, android.R.layout.simple_spinner_item);
|
||||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
combo.setAdapter(adapter);
|
combo.setAdapter(adapter);
|
||||||
combo.setSelection(4);
|
combo.setSelection(3);
|
||||||
|
|
||||||
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
combo = (Spinner) findViewById(R.id.max_time_old_event_combo);
|
||||||
adapter = ArrayAdapter.createFromResource(
|
adapter = ArrayAdapter.createFromResource(
|
||||||
@ -294,9 +294,11 @@ public class Main extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
combo = (Spinner) findViewById(R.id.severity_combo);
|
combo = (Spinner) findViewById(R.id.severity_combo);
|
||||||
this.object.severity = combo.getSelectedItemPosition() - 1;
|
//this.object.severity = combo.getSelectedItemPosition() - 1;//The next version re-add please
|
||||||
|
this.object.severity = combo.getSelectedItemPosition() - 2;
|
||||||
|
|
||||||
combo = (Spinner)findViewById(R.id.status_combo);
|
combo = (Spinner)findViewById(R.id.status_combo);
|
||||||
|
Log.e("Main search_form", "status_combo = " + combo.getSelectedItemPosition());
|
||||||
this.object.status = combo.getSelectedItemPosition() - 1;
|
this.object.status = combo.getSelectedItemPosition() - 1;
|
||||||
|
|
||||||
text = (EditText)findViewById(R.id.event_search_text);
|
text = (EditText)findViewById(R.id.event_search_text);
|
||||||
@ -338,7 +340,8 @@ public class Main extends Activity {
|
|||||||
filterSeverity = combo.getSelectedItemPosition() - 1;
|
filterSeverity = combo.getSelectedItemPosition() - 1;
|
||||||
|
|
||||||
combo = (Spinner)findViewById(R.id.status_combo);
|
combo = (Spinner)findViewById(R.id.status_combo);
|
||||||
filterStatus = combo.getSelectedItemPosition() - 1;
|
//filterStatus = combo.getSelectedItemPosition() - 1;//The next version re-add please
|
||||||
|
filterStatus = combo.getSelectedItemPosition() - 2;
|
||||||
|
|
||||||
combo = (Spinner)findViewById(R.id.max_time_old_event_combo);
|
combo = (Spinner)findViewById(R.id.max_time_old_event_combo);
|
||||||
filterLastTime = combo.getSelectedItemPosition();
|
filterLastTime = combo.getSelectedItemPosition();
|
||||||
|
@ -27,6 +27,8 @@ import org.apache.http.client.methods.HttpPost;
|
|||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
import org.apache.http.message.BasicNameValuePair;
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
|
||||||
|
import pandroid_event_viewer.pandorafms.R;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.TabActivity;
|
import android.app.TabActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -157,57 +159,19 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
/*Intent i = getIntent();
|
|
||||||
long count_events = i.getLongExtra("count_events", 0);
|
|
||||||
int more_criticity = i.getIntExtra("more_criticity", -1);
|
|
||||||
|
|
||||||
CharSequence text;
|
|
||||||
|
|
||||||
if (count_events > 0) {
|
|
||||||
//From the notificy
|
|
||||||
switch (more_criticity) {
|
|
||||||
case 0:
|
|
||||||
text = getString(R.string.loading_events_criticity_0_str)
|
|
||||||
.replace("%s", new Long(count_events).toString());
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
text = getString(R.string.loading_events_criticity_1_str)
|
|
||||||
.replace("%s", new Long(count_events).toString());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
text = getString(R.string.loading_events_criticity_2_str)
|
|
||||||
.replace("%s", new Long(count_events).toString());
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
text = getString(R.string.loading_events_criticity_3_str)
|
|
||||||
.replace("%s", new Long(count_events).toString());
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
text = getString(R.string.loading_events_criticity_4_str)
|
|
||||||
.replace("%s", new Long(count_events).toString());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
text = getString(R.string.loading_events_criticity_2_str)
|
|
||||||
.replace("%s", new Long(count_events).toString());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Toast toast = Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT);
|
|
||||||
toast.show();
|
|
||||||
|
|
||||||
//Set the time when the watcher find the events.
|
|
||||||
SharedPreferences preferences = getSharedPreferences(
|
|
||||||
getString(R.string.const_string_preferences),
|
|
||||||
Activity.MODE_PRIVATE);
|
|
||||||
this.timestamp = preferences.getLong("previous_filterTimestamp", (new Date().getTime() / 1000));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
this.getTabHost().setCurrentTab(1);
|
this.getTabHost().setCurrentTab(1);
|
||||||
|
|
||||||
if (this.showTabListFirstTime) {
|
Intent i = getIntent();
|
||||||
executeBackgroundGetEvents();
|
long count_events = i.getLongExtra("count_events", 0);
|
||||||
this.showTabListFirstTime = false;
|
|
||||||
|
if (count_events > 0) {
|
||||||
|
process_notification(i);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.showTabListFirstTime) {
|
||||||
|
executeBackgroundGetEvents();
|
||||||
|
this.showTabListFirstTime = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,6 +182,10 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||||||
public void onNewIntent(Intent intent) {
|
public void onNewIntent(Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
|
|
||||||
|
process_notification(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process_notification(Intent intent) {
|
||||||
long count_events = intent.getLongExtra("count_events", 0);
|
long count_events = intent.getLongExtra("count_events", 0);
|
||||||
int more_criticity = intent.getIntExtra("more_criticity", -1);
|
int more_criticity = intent.getIntExtra("more_criticity", -1);
|
||||||
|
|
||||||
@ -260,11 +228,14 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||||||
SharedPreferences preferences = getSharedPreferences(
|
SharedPreferences preferences = getSharedPreferences(
|
||||||
getString(R.string.const_string_preferences),
|
getString(R.string.const_string_preferences),
|
||||||
Activity.MODE_PRIVATE);
|
Activity.MODE_PRIVATE);
|
||||||
this.timestamp = preferences.getLong("previous_filterTimestamp", (new Date().getTime() / 1000));
|
long timestamp_notification = preferences.getLong("previous_filterTimestamp", (new Date().getTime() / 1000));
|
||||||
|
Log.e("PandroidEventviewerActivity process_notification", "time_noti = " + timestamp_notification);
|
||||||
|
this.timestamp = timestamp_notification;
|
||||||
|
Log.e("PandroidEventviewerActivity process_notification", "" +this.timestamp);
|
||||||
this.agentNameStr = preferences.getString("filterAgentName", "");
|
this.agentNameStr = preferences.getString("filterAgentName", "");
|
||||||
this.id_group = preferences.getInt("filterIDGroup", 0);
|
this.id_group = preferences.getInt("filterIDGroup", 0);
|
||||||
this.severity = preferences.getInt("filterSeverity", -1);
|
this.severity = preferences.getInt("filterSeverity", -1);
|
||||||
this.status = preferences.getInt("filterStatus", 4);
|
this.status = preferences.getInt("filterStatus", 3);
|
||||||
this.eventSearch = preferences.getString("filterEventSearch", "");
|
this.eventSearch = preferences.getString("filterEventSearch", "");
|
||||||
|
|
||||||
this.getTabHost().setCurrentTab(1);
|
this.getTabHost().setCurrentTab(1);
|
||||||
@ -365,6 +336,7 @@ public class PandroidEventviewerActivity extends TabActivity implements Serializ
|
|||||||
entityResponse = response.getEntity();
|
entityResponse = response.getEntity();
|
||||||
|
|
||||||
return_api = Core.convertStreamToString(entityResponse.getContent());
|
return_api = Core.convertStreamToString(entityResponse.getContent());
|
||||||
|
return_api = return_api.replaceAll("\\<.*?\\>", ""); //Clean html tags.
|
||||||
Log.e("return_api", return_api);
|
Log.e("return_api", return_api);
|
||||||
|
|
||||||
String[] lines = return_api.split("\n");
|
String[] lines = return_api.split("\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user