2012-05-22 Santiago Munín <burning1@gmail.com>

* PandroidEventviewerService.java, PandroidEventviewerActivity.java: Added group filter.
	* res/layout/main.xml: Enabled group spinner.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6335 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
santimunin 2012-05-22 14:53:15 +00:00
parent 744c5a0dcd
commit 727ecf76f7
4 changed files with 39 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2012-05-22 Santiago Munín <burning1@gmail.com>
* PandroidEventviewerService.java, PandroidEventviewerActivity.java: Added group filter.
* res/layout/main.xml: Enabled group spinner.
2012-05-21 Santiago Munín <burning1@gmail.com>
* EventList.java, PopupValidationEvent.java: Removed references to Core as an object.

View File

@ -51,7 +51,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow android:visibility="gone" >
<TableRow>
<TextView
android:layout_width="wrap_content"
@ -64,7 +64,7 @@
android:id="@+id/group_combo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
/>
<ProgressBar
android:id="@+id/loading_group"

View File

@ -64,7 +64,7 @@ public class PandroidEventviewerActivity extends TabActivity implements
// Parameters to search in the API
public String agentNameStr;
public int id_group;
public int id_group = -1;
public long timestamp;
public int severity;
public int pagination;
@ -248,10 +248,10 @@ public class PandroidEventviewerActivity extends TabActivity implements
/**
* Serializes all params.
*
* @param total True if only want the count
* @return All params in a string.
*/
private String serializeParams2Api() {
private String serializeParams2Api(boolean total) {
String return_var = "";
return_var += ';'; // Separator for the csv
@ -279,7 +279,14 @@ public class PandroidEventviewerActivity extends TabActivity implements
// list events
return_var += "|";
return_var += Long.toString(this.offset); // The offset of list events
return_var += "|";
if (total) {
return_var+="total";
} else {
return_var+="-1";
}
return_var += "|";
return_var += Integer.toString(this.id_group);
Log.i(TAG + " serializeParams2Api", return_var);
return return_var;
@ -320,7 +327,7 @@ public class PandroidEventviewerActivity extends TabActivity implements
"url_encode_separator_|"));
parameters.add(new BasicNameValuePair("return_type", "csv"));
parameters.add(new BasicNameValuePair("other",
serializeParams2Api() + "|total"));
serializeParams2Api(true)));
entity = new UrlEncodedFormEntity(parameters);
httpPost.setEntity(entity);
response = httpClient.execute(httpPost);
@ -345,7 +352,7 @@ public class PandroidEventviewerActivity extends TabActivity implements
"url_encode_separator_|"));
parameters.add(new BasicNameValuePair("return_type", "csv"));
parameters.add(new BasicNameValuePair("other",
serializeParams2Api()));
serializeParams2Api(false)));
entity = new UrlEncodedFormEntity(parameters);
httpPost.setEntity(entity);
response = httpClient.execute(httpPost);

View File

@ -110,7 +110,7 @@ public class PandroidEventviewerService extends IntentService {
httpPost = new HttpPost(this.url + "/include/api.php");
String parametersAPI = serializeParams2Api(context);
String parametersAPI = serializeParams2Api(context, false);
// Get total count.
parameters = new ArrayList<NameValuePair>();
@ -184,16 +184,14 @@ public class PandroidEventviewerService extends IntentService {
* @param context
* @return Api call.
*/
public String serializeParams2Api(Context context) {
public String serializeParams2Api(Context context, boolean total) {
SharedPreferences preferences = context.getSharedPreferences(
context.getString(R.string.const_string_preferences),
Activity.MODE_PRIVATE);
String filterAgentName = preferences.getString("filterAgentName", "");
/*
* TODO no api parameter, waiting for it int filterIDGroup =
* preferences.getInt("filterIDGroup", 0);
*/
int idGroup = preferences.getInt("filterIDGroup", 0);
int filterSeverity = preferences.getInt("filterSeverity", -1);
int filterStatus = preferences.getInt("filterStatus", 3);
String filterEventSearch = preferences.getString("filterEventSearch",
@ -238,13 +236,27 @@ public class PandroidEventviewerService extends IntentService {
return_var += filterEventSearch; // The free search in the text event
// description.
return_var += "|";
return_var += Integer.toString(0); // The pagination of list events
return_var += Integer.toString(100); // The pagination of list events
return_var += "|";
return_var += Long.toString(0); // The offset of list events
return_var += "|";
if (total) {
return_var += "total";
} else {
return_var += "-1";
}
return_var += "|";
return_var += Integer.toString(idGroup);
Log.i(TAG + " serializeParams2Api", return_var);
return return_var;
//;|-1|||||1337666333||3||20|0|total|-1
//;|-1|||||1337695530||3||0 |0| |12
//;|-1|||||1337695739||3||0 |0|-1 |2
//;|-1|||||1337666333||3||20|0|-1 |2
//;|-1|||||1337695739||3||0 |0|-1 |12
//;|-1|||||1337666333||3||20|0|-1|-1
}
/**