</activity>
<!-- Checkout Activities -->
- <activity android:name=".accountAccess.ItemsCheckOutListView"></activity>
+ <activity android:name=".accountAccess.checkout.ItemsCheckOutListView"></activity>
<!-- Holds Activities -->
<activity android:name=".accountAccess.holds.HoldsListView"></activity>
<activity android:name=".accountAccess.holds.PlaceHold"></activity>
<activity android:name=".accountAccess.holds.HoldDetails"></activity>
+ <!-- Fines Activities -->
+ <activity android:name=".accountAccess.fines.FinesActivity"></activity>
+
<activity android:name=".searchCatalog.RecordDetails_Info"></activity>
<activity android:name=".searchCatalog.RecordDetails_Content"></activity>
<activity android:name=".searchCatalog.RecordDetails_Details"></activity>
<activity android:name=".searchCatalog.RecordDetails"></activity>
<activity android:name=".searchCatalog.RecordDetails_Simple"></activity>
+
+
</application>
</manifest>
\ No newline at end of file
public static final int account_btn_check_out=0x7f090007;
public static final int account_btn_fines=0x7f090009;
public static final int account_btn_holds=0x7f090008;
- public static final int action_bar=0x7f090010;
- public static final int back_button=0x7f090011;
- public static final int cancel_hold=0x7f090021;
- public static final int cancel_hold_button=0x7f090012;
+ public static final int action_bar=0x7f090014;
+ public static final int back_button=0x7f090015;
+ public static final int cancel_hold=0x7f090025;
+ public static final int cancel_hold_button=0x7f090016;
public static final int checkout_due_date=0x7f090005;
public static final int checkout_items_list=0x7f090001;
public static final int checkout_record_author=0x7f090003;
public static final int checkout_record_title=0x7f090002;
public static final int checkout_renewals_remaining=0x7f090004;
- public static final int chose_organisation=0x7f090036;
- public static final int header=0x7f09000e;
- public static final int header_title=0x7f09000f;
- public static final int hold_author=0x7f090016;
- public static final int hold_contact_telephone=0x7f090018;
- public static final int hold_enable_email_notification=0x7f09001a;
- public static final int hold_enable_phone_notification=0x7f090019;
- public static final int hold_expiration_date=0x7f09001c;
- public static final int hold_physical_description=0x7f090017;
- public static final int hold_pickup_location=0x7f09001b;
- public static final int hold_recipient=0x7f090014;
- public static final int hold_status=0x7f090020;
- public static final int hold_suspend_hold=0x7f09001d;
- public static final int hold_thaw_date=0x7f090023;
- public static final int hold_title=0x7f090015;
- public static final int holds_item_list=0x7f09001f;
- public static final int holds_number=0x7f09001e;
+ public static final int chose_organisation=0x7f09003a;
+ public static final int fined_balance_owed=0x7f090010;
+ public static final int fines_overdue_materials_list=0x7f090011;
+ public static final int fines_total_owned=0x7f09000e;
+ public static final int fines_total_paid=0x7f09000f;
+ public static final int header=0x7f090012;
+ public static final int header_title=0x7f090013;
+ public static final int hold_author=0x7f09001a;
+ public static final int hold_contact_telephone=0x7f09001c;
+ public static final int hold_enable_email_notification=0x7f09001e;
+ public static final int hold_enable_phone_notification=0x7f09001d;
+ public static final int hold_expiration_date=0x7f090020;
+ public static final int hold_physical_description=0x7f09001b;
+ public static final int hold_pickup_location=0x7f09001f;
+ public static final int hold_recipient=0x7f090018;
+ public static final int hold_status=0x7f090024;
+ public static final int hold_suspend_hold=0x7f090021;
+ public static final int hold_thaw_date=0x7f090027;
+ public static final int hold_title=0x7f090019;
+ public static final int holds_item_list=0x7f090023;
+ public static final int holds_number=0x7f090022;
public static final int main_btn_account=0x7f09000c;
public static final int main_btn_app_settings=0x7f09000d;
public static final int main_btn_search=0x7f09000b;
- public static final int place_hold=0x7f090022;
- public static final int record_details_info_author=0x7f090025;
- public static final int record_details_info_publisher=0x7f090026;
- public static final int record_details_info_title=0x7f090024;
- public static final int record_details_simple_author=0x7f090028;
- public static final int record_details_simple_isbn=0x7f09002d;
- public static final int record_details_simple_publisher=0x7f090029;
- public static final int record_details_simple_series=0x7f09002b;
- public static final int record_details_simple_subject=0x7f09002a;
- public static final int record_details_simple_synopsis=0x7f09002c;
- public static final int record_details_simple_title=0x7f090027;
+ public static final int place_hold=0x7f090026;
+ public static final int record_details_info_author=0x7f090029;
+ public static final int record_details_info_publisher=0x7f09002a;
+ public static final int record_details_info_title=0x7f090028;
+ public static final int record_details_simple_author=0x7f09002c;
+ public static final int record_details_simple_isbn=0x7f090031;
+ public static final int record_details_simple_publisher=0x7f09002d;
+ public static final int record_details_simple_series=0x7f09002f;
+ public static final int record_details_simple_subject=0x7f09002e;
+ public static final int record_details_simple_synopsis=0x7f090030;
+ public static final int record_details_simple_title=0x7f09002b;
public static final int renew_button=0x7f090006;
- public static final int searchButton=0x7f090034;
- public static final int searchText=0x7f090033;
- public static final int search_more_items_button=0x7f09002e;
- public static final int search_record_author=0x7f090031;
- public static final int search_record_img=0x7f09002f;
- public static final int search_record_publishing=0x7f090032;
- public static final int search_record_title=0x7f090030;
+ public static final int searchButton=0x7f090038;
+ public static final int searchText=0x7f090037;
+ public static final int search_more_items_button=0x7f090032;
+ public static final int search_record_author=0x7f090035;
+ public static final int search_record_img=0x7f090033;
+ public static final int search_record_publishing=0x7f090036;
+ public static final int search_record_title=0x7f090034;
public static final int search_result_number=0x7f090000;
- public static final int search_results_list=0x7f090035;
- public static final int update_hold_button=0x7f090013;
+ public static final int search_results_list=0x7f090039;
+ public static final int update_hold_button=0x7f090017;
}
public static final class layout {
public static final int checkout_list=0x7f030000;
public static final int checkout_list_item=0x7f030001;
public static final int dashbord_account=0x7f030002;
public static final int dashbord_main=0x7f030003;
- public static final int hold_details=0x7f030004;
- public static final int holds_list=0x7f030005;
- public static final int holds_list_item=0x7f030006;
- public static final int main=0x7f030007;
- public static final int place_hold=0x7f030008;
- public static final int record_details_info=0x7f030009;
- public static final int record_details_simple=0x7f03000a;
- public static final int search_result_footer_view=0x7f03000b;
- public static final int search_result_item=0x7f03000c;
- public static final int search_result_list=0x7f03000d;
+ public static final int fines=0x7f030004;
+ public static final int hold_details=0x7f030005;
+ public static final int holds_list=0x7f030006;
+ public static final int holds_list_item=0x7f030007;
+ public static final int main=0x7f030008;
+ public static final int place_hold=0x7f030009;
+ public static final int record_details_info=0x7f03000a;
+ public static final int record_details_simple=0x7f03000b;
+ public static final int search_result_footer_view=0x7f03000c;
+ public static final int search_result_item=0x7f03000d;
+ public static final int search_result_list=0x7f03000e;
}
public static final class string {
public static final int app_name=0x7f070001;
public static final int author=0x7f07000d;
public static final int back=0x7f070019;
+ public static final int balance_owed=0x7f07001f;
public static final int cancel=0x7f070017;
public static final int cancel_hold=0x7f070018;
public static final int cancel_hold_dialog_message=0x7f07001b;
public static final int title_holds=0x7f070006;
public static final int title_my_account=0x7f070003;
public static final int title_search=0x7f070002;
+ /** Fines Activity
+ */
+ public static final int total_owned=0x7f07001d;
+ public static final int total_paid=0x7f07001e;
public static final int update_hold=0x7f07001a;
}
public static final class style {
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical" >
+
+ <TableLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <TableRow
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/total_owned"
+ />
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/total_paid"
+ />
+
+ <TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/balance_owed"
+ />
+
+ </TableRow>
+ <TableRow
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+ <TextView
+ android:id="@+id/fines_total_owned"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ />
+ <TextView
+ android:id="@+id/fines_total_paid"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ />
+ <TextView
+ android:id="@+id/fined_balance_owed"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ />
+ </TableRow>
+
+ </TableLayout>
+
+
+
+ <ListView
+ android:id="@+id/fines_overdue_materials_list"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ ></ListView>
+
+</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
+ android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left|center"
android:paddingBottom="3px"
<string name="update_hold">Update Hold</string>
<string name="cancel_hold_dialog_message">Are you sure you want to cancel this hold?</string>
<string name="thaw_date">Automatically activate hold one</string>
+
+
+ <!-- Fines Activity -->
+ <string name="total_owned">Total Owned </string>
+ <string name="total_paid">Total Paid</string>
+ <string name="balance_owed">Balance Owed</string>
+
</resources>
\ No newline at end of file
import java.util.List;
import java.util.Map;
+import org.evergreen.android.accountAccess.checkout.CircRecord;
import org.evergreen.android.accountAccess.holds.HoldRecord;
import org.evergreen.android.globals.Utils;
import org.evergreen.android.searchCatalog.RecordInfo;
ahr.put("usr", userID);
ahr.put("requestor", userID);
+ //TODO
//do not set hold type, the systems knows the hold type
- //ahr.put("hold_type", "T");
+ ahr.put("hold_type", null);
ahr.put("pickup_lib", pickup_lib); //pick-up lib
- ahr.put("phone_notify", phone);
- ahr.put("email_notify", email_notify);
- ahr.put("expire_time",expire_time);
+ //ahr.put("phone_notify", phone);
+ //ahr.put("email_notify", email_notify);
+ //ahr.put("expire_time",expire_time);
//frozen set, what this means ?
ahr.put("frozen", suspendHold);
//only if it is frozen
- ahr.put("thaw_date",thaw_date);
+ //ahr.put("thaw_date",thaw_date);
//extra parameters (not mandatory for hold creation)
//----------------------------Fines Summary------------------------------------//
- public OSRFObject getFinesSummary(){
+ public float[] getFinesSummary(){
+ //mous object
OSRFObject finesSummary = (OSRFObject) Utils.doRequest(conn,SERVICE_ACTOR, METHOD_FETCH_FINES_SUMMARY, new Object[]{authToken,userID});
- return finesSummary;
+ float fines[] = new float[3];
+ try{
+ fines[0] = Float.parseFloat(finesSummary.getString("total_owed"));
+ fines[1] = Float.parseFloat(finesSummary.getString("total_paid"));
+ fines[2] = Float.parseFloat(finesSummary.getString("balance_owed"));
+ }catch(Exception e){
+ System.err.println("Exception in parsing fines " + e.getMessage());
+ }
+
+ return fines;
}
private Object getTransactions(){
return transactions;
}
+ //---------------------------------------Book bags-----------------------------------//
+
public Object getBookbags(){
Object response = Utils.doRequest(conn,SERVICE_ACTOR, METHOD_FLESH_CONTAINERS, new Object[]{authToken,userID,"biblio","bookbag"});
+++ /dev/null
-package org.evergreen.android.accountAccess;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.evergreen.android.globals.GlobalConfigs;
-import org.opensrf.util.OSRFObject;
-
-/**
- * This is a wrapper class that get the information out for a circ object
- * @author daniel
- *
- */
-public class CircRecord {
-
- public static final int MVR_OBJ_TYPE = 1;
- public static final int ACP_OBJ_TYPE = 2;
- public static final int UNDEF_OBJ_TYPE = 0;
-
- public OSRFObject mvr = null;
-
- public OSRFObject acp = null;
-
- public OSRFObject circ = null;
-
- public int circ_info_type = UNDEF_OBJ_TYPE;
-
- public int circ_type;
-
- public static final int OUT = 0;
- public static final int CLAIMS_RETURNED = 1;
- public static final int LONG_OVERDUE = 2;
- public static final int OVERDUE = 3;
- public static final int LOST = 4;
-
- public int circ_id = -1;
-
- private Date circ_due_date = null;
-
- public CircRecord(OSRFObject circ, OSRFObject mvr, OSRFObject acp, int circ_type, int circ_id) {
-
- this.circ = circ;
-
- //one of the acp or mvr will be null this will determine the circ OSRFObject type
- this.acp = acp;
- this.mvr = mvr;
-
- if(this.acp != null)
- this.circ_info_type = ACP_OBJ_TYPE;
-
- if(this.mvr != null)
- this.circ_info_type = MVR_OBJ_TYPE;
-
- this.circ_type = circ_type;
- this.circ_id = circ_id;
- //parse due date
- parseDate(circ);
- }
-
- public CircRecord(OSRFObject circ,int circ_type, int circ_id){
- this.circ = circ;
- this.circ_type = circ_type;
- this.circ_id = circ_id;
- //parse due date
- parseDate(circ);
- }
-
- public String getAuthor(){
-
- String author = null;
-
- if(this.circ_info_type == MVR_OBJ_TYPE)
- author = mvr.getString("author");
- if(this.circ_info_type == ACP_OBJ_TYPE)
- author = acp.getString("dummy_author");
-
- return author;
- }
-
-
- public String getDueDate(){
-
- return circ_due_date.toLocaleString();
- }
-
- public String getTitle(){
-
- String title = null;
-
- if(this.circ_info_type == MVR_OBJ_TYPE)
- title = mvr.getString("title");
- if(this.circ_info_type == ACP_OBJ_TYPE)
- title = acp.getString("dummy_title");
-
- return title;
- }
-
- public Integer getRenewals(){
-
- if(circ != null)
- return circ.getInt("renewal_remaining");
-
- return null;
- }
-
- public Integer getTargetCopy(){
- if(circ != null)
- return circ.getInt("target_copy");
-
- return null;
- }
-
- private void parseDate(OSRFObject circ){
-
- this.circ_due_date = GlobalConfigs.parseDate(circ.getString("due_date"));
- System.out.println(this.circ_due_date);
-
- }
-
-}
+++ /dev/null
-package org.evergreen.android.accountAccess;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.evergreen.android.R;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class ItemsCheckOutListView extends Activity{
-
- private String TAG = "ItemsCheckOutListView";
-
- private AccountAccess accountAccess = null;
-
- private ListView lv;
-
- private CheckOutArrayAdapter listAdapter = null;
-
- private ArrayList<CircRecord> circRecords = null;
-
- private Context context;
-
- private ProgressDialog progressDialog;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- // TODO Auto-generated method stub
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.checkout_list);
-
- context = this;
- accountAccess = AccountAccess.getAccountAccess();
- lv = (ListView) findViewById(R.id.checkout_items_list);
- circRecords = new ArrayList<CircRecord>();
- listAdapter = new CheckOutArrayAdapter(context, R.layout.checkout_list_item, circRecords);
- lv.setAdapter(listAdapter);
-
- Thread getCirc = new Thread(new Runnable() {
-
- @Override
- public void run() {
-
- circRecords = accountAccess.getItemsCheckedOut();
-
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- for(int i=0;i<circRecords.size();i++)
- listAdapter.add(circRecords.get(i));
-
-
- progressDialog.dismiss();
-
- if(circRecords.size() == 0)
- Toast.makeText(context, "No circ records", Toast.LENGTH_LONG);
-
- listAdapter.notifyDataSetChanged();
- }
- });
- }
- });
-
-
- if(accountAccess.isAuthenticated()){
- progressDialog = new ProgressDialog(context);
- progressDialog.setMessage("Please wait while retrieving circ data");
- progressDialog.show();
- getCirc.start();
-
- }
- else
- Toast.makeText(context, "You must be authenticated to retrieve circ records", Toast.LENGTH_LONG);
-
-
- }
-
- class CheckOutArrayAdapter extends ArrayAdapter<CircRecord> {
- private static final String tag = "CheckoutArrayAdapter";
-
- private TextView recordTitle;
- private TextView recordAuthor;
- private TextView recordDueDate;
- private TextView recordRenewals;
- private TextView renewButton;
-
- private List<CircRecord> records = new ArrayList<CircRecord>();
-
- public CheckOutArrayAdapter(Context context, int textViewResourceId,
- List<CircRecord> objects) {
- super(context, textViewResourceId, objects);
- this.records = objects;
- }
-
- public int getCount() {
- return this.records.size();
- }
-
- public CircRecord getItem(int index) {
- return this.records.get(index);
- }
-
- public View getView(int position, View convertView, ViewGroup parent) {
- View row = convertView;
-
- // Get item
- final CircRecord record = getItem(position);
-
-
- if(record == null)
- {
- Log.d(tag, "Starting XML view more infaltion ... ");
- LayoutInflater inflater = (LayoutInflater) this.getContext()
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- row = inflater.inflate(R.layout.search_result_footer_view, parent, false);
- Log.d(tag, "Successfully completed XML view more Inflation!");
-
-
- }
- else{
-
- //if it is the right type of view
- if (row == null ) {
-
- Log.d(tag, "Starting XML Row Inflation ... ");
- LayoutInflater inflater = (LayoutInflater) this.getContext()
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- row = inflater.inflate(R.layout.checkout_list_item, parent, false);
- Log.d(tag, "Successfully completed XML Row Inflation!");
-
- }
-
- // Get reference to TextView - title
- recordTitle = (TextView) row.findViewById(R.id.checkout_record_title);
-
- // Get reference to TextView - author
- recordAuthor = (TextView) row.findViewById(R.id.checkout_record_author);
-
- //Get reference to TextView - record Publisher date+publisher
- recordDueDate = (TextView) row.findViewById(R.id.checkout_due_date);
-
- //Get remaining renewals
- recordRenewals = (TextView) row.findViewById(R.id.checkout_renewals_remaining);
-
- renewButton = (TextView) row.findViewById(R.id.renew_button);
-
- renewButton.setText("renew : " + record.getRenewals());
-
- renewButton.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
-
- Thread renew = new Thread(new Runnable() {
-
- @Override
- public void run() {
- boolean refresh = true;
- AccountAccess ac = AccountAccess.getAccountAccess();
-
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- progressDialog = new ProgressDialog(context);
- progressDialog.setMessage("Renew item please wait.");
- progressDialog.show();
- }
- });
-
- try{
- ac.renewCirc(record.getTargetCopy());
- }catch(MaxRenewalsException e){
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- progressDialog.dismiss();
- Toast.makeText(context, "Max renewals reached", Toast.LENGTH_SHORT).show();
- }
- });
-
- refresh = false;
- }
- if(refresh){
- circRecords = accountAccess.getItemsCheckedOut();
- listAdapter.clear();
- for(int i=0;i<circRecords.size();i++){
- listAdapter.add(circRecords.get(i));
- }
- runOnUiThread(new Runnable() {
-
- @Override
- public void run() {
- progressDialog.dismiss();
- listAdapter.notifyDataSetChanged();
- }
- });
- }
- }
- });
-
- renew.start();
- }
- });
- //set text
- System.out.println("Row" + record.getTitle() + " " + record.getAuthor() + " " + record.getDueDate() + " " + record.getRenewals());
- recordTitle.setText(record.getTitle());
- recordAuthor.setText(record.getAuthor());
- recordDueDate.setText(record.getDueDate());
- recordRenewals.setText(record.getRenewals()+"");
- }
-
- return row;
- }
- }
-}
--- /dev/null
+package org.evergreen.android.accountAccess.checkout;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.evergreen.android.globals.GlobalConfigs;
+import org.opensrf.util.OSRFObject;
+
+/**
+ * This is a wrapper class that get the information out for a circ object
+ * @author daniel
+ *
+ */
+public class CircRecord {
+
+ public static final int MVR_OBJ_TYPE = 1;
+ public static final int ACP_OBJ_TYPE = 2;
+ public static final int UNDEF_OBJ_TYPE = 0;
+
+ public OSRFObject mvr = null;
+
+ public OSRFObject acp = null;
+
+ public OSRFObject circ = null;
+
+ public int circ_info_type = UNDEF_OBJ_TYPE;
+
+ public int circ_type;
+
+ public static final int OUT = 0;
+ public static final int CLAIMS_RETURNED = 1;
+ public static final int LONG_OVERDUE = 2;
+ public static final int OVERDUE = 3;
+ public static final int LOST = 4;
+
+ public int circ_id = -1;
+
+ private Date circ_due_date = null;
+
+ public CircRecord(OSRFObject circ, OSRFObject mvr, OSRFObject acp, int circ_type, int circ_id) {
+
+ this.circ = circ;
+
+ //one of the acp or mvr will be null this will determine the circ OSRFObject type
+ this.acp = acp;
+ this.mvr = mvr;
+
+ if(this.acp != null)
+ this.circ_info_type = ACP_OBJ_TYPE;
+
+ if(this.mvr != null)
+ this.circ_info_type = MVR_OBJ_TYPE;
+
+ this.circ_type = circ_type;
+ this.circ_id = circ_id;
+ //parse due date
+ parseDate(circ);
+ }
+
+ public CircRecord(OSRFObject circ,int circ_type, int circ_id){
+ this.circ = circ;
+ this.circ_type = circ_type;
+ this.circ_id = circ_id;
+ //parse due date
+ parseDate(circ);
+ }
+
+ public String getAuthor(){
+
+ String author = null;
+
+ if(this.circ_info_type == MVR_OBJ_TYPE)
+ author = mvr.getString("author");
+ if(this.circ_info_type == ACP_OBJ_TYPE)
+ author = acp.getString("dummy_author");
+
+ return author;
+ }
+
+
+ public String getDueDate(){
+
+ return circ_due_date.toLocaleString();
+ }
+
+ public String getTitle(){
+
+ String title = null;
+
+ if(this.circ_info_type == MVR_OBJ_TYPE)
+ title = mvr.getString("title");
+ if(this.circ_info_type == ACP_OBJ_TYPE)
+ title = acp.getString("dummy_title");
+
+ return title;
+ }
+
+ public Integer getRenewals(){
+
+ if(circ != null)
+ return circ.getInt("renewal_remaining");
+
+ return null;
+ }
+
+ public Integer getTargetCopy(){
+ if(circ != null)
+ return circ.getInt("target_copy");
+
+ return null;
+ }
+
+ private void parseDate(OSRFObject circ){
+
+ this.circ_due_date = GlobalConfigs.parseDate(circ.getString("due_date"));
+ System.out.println(this.circ_due_date);
+
+ }
+
+}
--- /dev/null
+package org.evergreen.android.accountAccess.checkout;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+import org.evergreen.android.accountAccess.MaxRenewalsException;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class ItemsCheckOutListView extends Activity{
+
+ private String TAG = "ItemsCheckOutListView";
+
+ private AccountAccess accountAccess = null;
+
+ private ListView lv;
+
+ private CheckOutArrayAdapter listAdapter = null;
+
+ private ArrayList<CircRecord> circRecords = null;
+
+ private Context context;
+
+ private ProgressDialog progressDialog;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ // TODO Auto-generated method stub
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.checkout_list);
+
+ context = this;
+ accountAccess = AccountAccess.getAccountAccess();
+ lv = (ListView) findViewById(R.id.checkout_items_list);
+ circRecords = new ArrayList<CircRecord>();
+ listAdapter = new CheckOutArrayAdapter(context, R.layout.checkout_list_item, circRecords);
+ lv.setAdapter(listAdapter);
+
+ Thread getCirc = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+
+ circRecords = accountAccess.getItemsCheckedOut();
+
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ for(int i=0;i<circRecords.size();i++)
+ listAdapter.add(circRecords.get(i));
+
+
+ progressDialog.dismiss();
+
+ if(circRecords.size() == 0)
+ Toast.makeText(context, "No circ records", Toast.LENGTH_LONG);
+
+ listAdapter.notifyDataSetChanged();
+ }
+ });
+ }
+ });
+
+
+ if(accountAccess.isAuthenticated()){
+ progressDialog = new ProgressDialog(context);
+ progressDialog.setMessage("Please wait while retrieving circ data");
+ progressDialog.show();
+ getCirc.start();
+
+ }
+ else
+ Toast.makeText(context, "You must be authenticated to retrieve circ records", Toast.LENGTH_LONG);
+
+
+ }
+
+ class CheckOutArrayAdapter extends ArrayAdapter<CircRecord> {
+ private static final String tag = "CheckoutArrayAdapter";
+
+ private TextView recordTitle;
+ private TextView recordAuthor;
+ private TextView recordDueDate;
+ private TextView recordRenewals;
+ private TextView renewButton;
+
+ private List<CircRecord> records = new ArrayList<CircRecord>();
+
+ public CheckOutArrayAdapter(Context context, int textViewResourceId,
+ List<CircRecord> objects) {
+ super(context, textViewResourceId, objects);
+ this.records = objects;
+ }
+
+ public int getCount() {
+ return this.records.size();
+ }
+
+ public CircRecord getItem(int index) {
+ return this.records.get(index);
+ }
+
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View row = convertView;
+
+ // Get item
+ final CircRecord record = getItem(position);
+
+
+ if(record == null)
+ {
+ Log.d(tag, "Starting XML view more infaltion ... ");
+ LayoutInflater inflater = (LayoutInflater) this.getContext()
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ row = inflater.inflate(R.layout.search_result_footer_view, parent, false);
+ Log.d(tag, "Successfully completed XML view more Inflation!");
+
+
+ }
+ else{
+
+ //if it is the right type of view
+ if (row == null ) {
+
+ Log.d(tag, "Starting XML Row Inflation ... ");
+ LayoutInflater inflater = (LayoutInflater) this.getContext()
+ .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ row = inflater.inflate(R.layout.checkout_list_item, parent, false);
+ Log.d(tag, "Successfully completed XML Row Inflation!");
+
+ }
+
+ // Get reference to TextView - title
+ recordTitle = (TextView) row.findViewById(R.id.checkout_record_title);
+
+ // Get reference to TextView - author
+ recordAuthor = (TextView) row.findViewById(R.id.checkout_record_author);
+
+ //Get reference to TextView - record Publisher date+publisher
+ recordDueDate = (TextView) row.findViewById(R.id.checkout_due_date);
+
+ //Get remaining renewals
+ recordRenewals = (TextView) row.findViewById(R.id.checkout_renewals_remaining);
+
+ renewButton = (TextView) row.findViewById(R.id.renew_button);
+
+ renewButton.setText("renew : " + record.getRenewals());
+
+ renewButton.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+ Thread renew = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ boolean refresh = true;
+ AccountAccess ac = AccountAccess.getAccountAccess();
+
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ progressDialog = new ProgressDialog(context);
+ progressDialog.setMessage("Renew item please wait.");
+ progressDialog.show();
+ }
+ });
+
+ try{
+ ac.renewCirc(record.getTargetCopy());
+ }catch(MaxRenewalsException e){
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ progressDialog.dismiss();
+ Toast.makeText(context, "Max renewals reached", Toast.LENGTH_SHORT).show();
+ }
+ });
+
+ refresh = false;
+ }
+ if(refresh){
+ circRecords = accountAccess.getItemsCheckedOut();
+ listAdapter.clear();
+ for(int i=0;i<circRecords.size();i++){
+ listAdapter.add(circRecords.get(i));
+ }
+ runOnUiThread(new Runnable() {
+
+ @Override
+ public void run() {
+ progressDialog.dismiss();
+ listAdapter.notifyDataSetChanged();
+ }
+ });
+ }
+ }
+ });
+
+ renew.start();
+ }
+ });
+ //set text
+ System.out.println("Row" + record.getTitle() + " " + record.getAuthor() + " " + record.getDueDate() + " " + record.getRenewals());
+ recordTitle.setText(record.getTitle());
+ recordAuthor.setText(record.getAuthor());
+ recordDueDate.setText(record.getDueDate());
+ recordRenewals.setText(record.getRenewals()+"");
+ }
+
+ return row;
+ }
+ }
+}
--- /dev/null
+package org.evergreen.android.accountAccess.fines;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.widget.ListView;
+import android.widget.TextView;
+
+public class FinesActivity extends Activity{
+
+
+ private TextView total_owned;
+
+ private TextView total_paid;
+
+ private TextView balance_owed;
+
+ private ListView overdue_materials;
+
+ private Runnable getFinesInfo;
+
+ private AccountAccess ac;
+
+ private ProgressDialog progressDialog;
+
+ private Context context;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.fines);
+
+ total_owned = (TextView) findViewById(R.id.fines_total_owned);
+ total_paid = (TextView) findViewById(R.id.fines_total_paid);
+ balance_owed = (TextView) findViewById(R.id.fined_balance_owed);
+ context = this;
+
+ ac = AccountAccess.getAccountAccess();
+
+
+ progressDialog = ProgressDialog.show(this, null, "Retrieving fines");
+
+ getFinesInfo = new Runnable() {
+ @Override
+ public void run() {
+
+ final float[] fines = ac.getFinesSummary();
+
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+
+ total_owned.setText(fines[0]+"");
+ total_paid.setText(fines[1]+"");
+ balance_owed.setText(fines[2]+"");
+ progressDialog.dismiss();
+ }
+ });
+ }
+ };
+
+ Thread getFinesTh = new Thread(getFinesInfo);
+ getFinesTh.start();
+ }
+}
package org.evergreen.android.accountAccess.holds;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
private Date thaw_date = null;
+ private GlobalConfigs globalConfigs = null;
+
+ private int selectedOrgPos = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.place_hold);
-
+ globalConfigs = GlobalConfigs.getGlobalConfigs(this);
RecordInfo record = (RecordInfo) getIntent().getSerializableExtra("recordInfo");
accountAccess = AccountAccess.getAccountAccess();
@Override
public void onClick(View v) {
-
-
accountAccess.getHoldPreCreateInfo(record_id, 4);
accountAccess.isHoldPossible(4, record_id);
+
String expire_date_s = null;
String thaw_date_s = null;
if(expire_date != null)
if(thaw_date != null)
thaw_date_s = GlobalConfigs.getStringDate(thaw_date);
- accountAccess.createHold(record_id,4,email_notification.isChecked(),phone_notification.isChecked(),phone_number.getText().toString(),suspendHold.isChecked(),expire_date_s,thaw_date_s);
+ System.out.println("date expire: " + expire_date_s + " " + expire_date);
+ int selectedOrgID = -1;
+ if(globalConfigs.organisations.size() > selectedOrgPos)
+ selectedOrgID = globalConfigs.organisations.get(selectedOrgPos).id;
+ accountAccess.createHold(record_id,selectedOrgID,email_notification.isChecked(),phone_notification.isChecked(),phone_number.getText().toString(),suspendHold.isChecked(),expire_date_s,thaw_date_s);
}
});
-
phone_notification.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
int monthOfYear, int dayOfMonth)
{
-
- Date chosenDate = new Date(year, monthOfYear,dayOfMonth);
+
+ Date chosenDate = new Date(year-1900, monthOfYear,dayOfMonth);
expire_date = chosenDate;
CharSequence strDate = DateFormat.format("MMMM dd, yyyy", chosenDate);
expiration_date.setText(strDate);
int monthOfYear, int dayOfMonth)
{
-
- Date chosenDate = new Date(year, monthOfYear,dayOfMonth);
+
+ Date chosenDate = new Date(year-1900, monthOfYear,dayOfMonth);
thaw_date = chosenDate;
CharSequence strDate = DateFormat.format("MMMM dd, yyyy", chosenDate);
- expiration_date.setText(strDate);
+ thaw_date_edittext.setText(strDate);
//set current date
}}, cal.get(Calendar.YEAR),cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
}
});
-
+ ArrayList<String> list = new ArrayList<String>();
+ for(int i=0;i<globalConfigs.organisations.size();i++){
+ list.add(globalConfigs.organisations.get(i).padding + globalConfigs.organisations.get(i).name);
+
+ if(globalConfigs.organisations.get(i).level -1 == 0)
+ selectedOrgPos = i;
+ }
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,list);
orgSelector.setAdapter(adapter);
-
- orgSelector.setSelection();
- orgSelectorn.setOnItemSelectedListener(new OnItemSelectedListener() {
+ orgSelector.setSelection(selectedOrgPos);
+
+ orgSelector.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int ID, long arg3) {
- //select the specific organization
- search.selectOrganisation(globalConfigs.organisations.get(ID));
+
+ selectedOrgPos = ID;
}
+
+ public void onNothingSelected(android.widget.AdapterView<?> arg0) {
+ }
+ });
}
public void disableView(View view){
//to parse date from requests
public static final String datePattern = "yyyy-MM-dd'T'hh:mm:ssZ";
-
+
/** The locale. */
public String locale = "en-US";
package org.evergreen.android.views;
import org.evergreen.android.R;
-import org.evergreen.android.accountAccess.ItemsCheckOutListView;
+import org.evergreen.android.accountAccess.checkout.ItemsCheckOutListView;
+import org.evergreen.android.accountAccess.fines.FinesActivity;
import org.evergreen.android.accountAccess.holds.HoldsListView;
import android.app.Activity;
startActivity (new Intent(getApplicationContext(), HoldsListView.class));
break;
case R.id.account_btn_fines :
- //startActivity (new Intent(getApplicationContext(), F5Activity.class));
+ startActivity (new Intent(getApplicationContext(), FinesActivity.class));
break;
case R.id.account_btn_book_bags :
//startActivity (new Intent(getApplicationContext(), F6Activity.class));