<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
- <classpathentry kind="lib" path="lib/org.opensrf.jar"/>
<classpathentry kind="lib" path="lib/simple-xml-2.6.4.jar"/>
+ <classpathentry kind="lib" path="lib/org.opensrf2_serialized_reg.jar"/>
+ <classpathentry kind="lib" path="lib/org.openils_idl.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
<!-- Holds Activities -->
<activity android:name=".accountAccess.holds.HoldsListView"></activity>
<activity android:name=".accountAccess.holds.PlaceHold"></activity>
-
+ <activity android:name=".accountAccess.holds.HoldDetails"></activity>
<activity android:name=".searchCatalog.RecordDetails_Info"></activity>
<activity android:name=".searchCatalog.RecordDetails_Content"></activity>
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=0x7f090015;
- public static final int cancel_hold=0x7f090016;
+ 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 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=0x7f090032;
- public static final int header=0x7f090013;
- public static final int header_title=0x7f090014;
- public static final int hold_author=0x7f090011;
- public static final int hold_contact_telephone=0x7f09001a;
- public static final int hold_enable_email_notification=0x7f09001c;
- public static final int hold_enable_phone_notification=0x7f09001b;
- public static final int hold_expiration_date=0x7f09001e;
- public static final int hold_physical_description=0x7f090019;
- public static final int hold_pickup_location=0x7f09001d;
- public static final int hold_recipient=0x7f090018;
- public static final int hold_status=0x7f090012;
- public static final int hold_suspend_hold=0x7f09001f;
- public static final int hold_title=0x7f090010;
- public static final int holds_item_list=0x7f09000f;
- public static final int holds_number=0x7f09000e;
+ public static final int chose_organisation=0x7f090035;
+ 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_title=0x7f090015;
+ public static final int holds_item_list=0x7f09001f;
+ public static final int holds_number=0x7f09001e;
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=0x7f090017;
- public static final int record_details_info_author=0x7f090021;
- public static final int record_details_info_publisher=0x7f090022;
- public static final int record_details_info_title=0x7f090020;
- public static final int record_details_simple_author=0x7f090024;
- public static final int record_details_simple_isbn=0x7f090029;
- public static final int record_details_simple_publisher=0x7f090025;
- public static final int record_details_simple_series=0x7f090027;
- public static final int record_details_simple_subject=0x7f090026;
- public static final int record_details_simple_synopsis=0x7f090028;
- public static final int record_details_simple_title=0x7f090023;
+ public static final int place_hold=0x7f090022;
+ public static final int record_details_info_author=0x7f090024;
+ public static final int record_details_info_publisher=0x7f090025;
+ public static final int record_details_info_title=0x7f090023;
+ public static final int record_details_simple_author=0x7f090027;
+ public static final int record_details_simple_isbn=0x7f09002c;
+ public static final int record_details_simple_publisher=0x7f090028;
+ public static final int record_details_simple_series=0x7f09002a;
+ public static final int record_details_simple_subject=0x7f090029;
+ public static final int record_details_simple_synopsis=0x7f09002b;
+ public static final int record_details_simple_title=0x7f090026;
public static final int renew_button=0x7f090006;
- public static final int searchButton=0x7f090030;
- public static final int searchText=0x7f09002f;
- public static final int search_more_items_button=0x7f09002a;
- public static final int search_record_author=0x7f09002d;
- public static final int search_record_img=0x7f09002b;
- public static final int search_record_publishing=0x7f09002e;
- public static final int search_record_title=0x7f09002c;
+ public static final int searchButton=0x7f090033;
+ public static final int searchText=0x7f090032;
+ public static final int search_more_items_button=0x7f09002d;
+ public static final int search_record_author=0x7f090030;
+ public static final int search_record_img=0x7f09002e;
+ public static final int search_record_publishing=0x7f090031;
+ public static final int search_record_title=0x7f09002f;
public static final int search_result_number=0x7f090000;
- public static final int search_results_list=0x7f090031;
+ public static final int search_results_list=0x7f090034;
+ public static final int update_hold_button=0x7f090013;
}
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 holds_list=0x7f030004;
- public static final int holds_list_item=0x7f030005;
- public static final int main=0x7f030006;
- public static final int place_hold=0x7f030007;
- public static final int record_details_info=0x7f030008;
- public static final int record_details_simple=0x7f030009;
- public static final int search_result_footer_view=0x7f03000a;
- public static final int search_result_item=0x7f03000b;
- public static final int search_result_list=0x7f03000c;
+ 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 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 cancel=0x7f070017;
+ public static final int cancel_hold=0x7f070018;
+ public static final int cancel_hold_dialog_message=0x7f07001b;
public static final int contact_email_address=0x7f070011;
public static final int contact_telephone=0x7f07000f;
public static final int enable_email_notification=0x7f070012;
public static final int title_holds=0x7f070006;
public static final int title_my_account=0x7f070003;
public static final int title_search=0x7f070002;
+ public static final int update_hold=0x7f07001a;
}
public static final class style {
public static final int AuthorSearchStyleList=0x7f080007;
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+
+ <LinearLayout
+ android:id="@+id/header"
+ android:layout_width="fill_parent"
+ android:layout_height="40dip"
+ android:background="@color/blue"
+ android:layout_alignParentTop="true"
+ >
+ <TextView
+ android:id="@+id/header_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="5dip"
+ android:paddingTop="5dip"
+ android:textColor="@color/white"
+ android:textStyle="bold"
+ android:textSize="16dip"
+ />
+
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/action_bar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_horizontal"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true"
+ >
+ <Button
+ android:id="@+id/back_button"
+ android:layout_width="100dip"
+ android:layout_height="wrap_content"
+ android:text="@string/back"
+ />
+
+ <Button
+ android:id="@+id/cancel_hold_button"
+ android:layout_width="100dip"
+ android:layout_height="wrap_content"
+ android:text="@string/cancel_hold"
+ />
+
+ <Button
+ android:id="@+id/update_hold_button"
+ android:layout_width="100dip"
+ android:layout_height="wrap_content"
+ android:text="@string/update_hold"
+ />
+ </LinearLayout>
+
+ <ScrollView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:fillViewport="true"
+ android:layout_above="@id/action_bar"
+ android:layout_below="@id/header"
+ >
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ >
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/recipient"
+ />
+
+ <TextView
+ android:id="@+id/hold_recipient"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/title"
+ />
+
+ <TextView
+ android:id="@+id/hold_title"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/author"
+ />
+
+ <TextView
+ android:id="@+id/hold_author"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/physical_description"
+ />
+
+ <TextView
+ android:id="@+id/hold_physical_description"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/contact_telephone"
+ />
+
+ <TextView
+ android:id="@+id/hold_contact_telephone"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/enable_phone_notification"
+ />
+
+ <CheckBox
+ android:id="@+id/hold_enable_phone_notification"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/enable_email_notification"
+ />
+
+ <CheckBox
+ android:id="@+id/hold_enable_email_notification"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/pickup_location"
+ />
+
+ <Spinner
+ android:id="@+id/hold_pickup_location"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/expiration_date"
+ />
+
+ <EditText
+ android:id="@+id/hold_expiration_date"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ >
+ <TextView
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="2"
+ android:text="@string/suspend_hold"
+ />
+
+ <CheckBox
+ android:id="@+id/hold_suspend_hold"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="4"
+ android:gravity="center"
+ />
+ </LinearLayout>
+
+ </LinearLayout>
+
+ </ScrollView>
+
+
+</RelativeLayout>
\ No newline at end of file
android:text="@string/expiration_date"
/>
- <TextView
+ <EditText
android:id="@+id/hold_expiration_date"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="4"
android:gravity="center"
- />
+ />
+
+
</LinearLayout>
<LinearLayout
<string name="suspend_hold">Suspend Hold</string>
<string name="place_hold">Place hold</string>
<string name="cancel">Cancel</string>
-
+ <string name="cancel_hold">Cancel hold</string>
+ <string name="back">Back</string>
+ <string name="update_hold">Update Hold</string>
+ <string name="cancel_hold_dialog_message">Are you sure you want to cancel this hold?</string>
</resources>
\ No newline at end of file
/** The auth token.
* Sent with every request that needs authentication
* */
- public static String authToken = null;
+ public String authToken = null;
/** The auth time. */
private Integer authTime = null;
Map<String,?> response = (Map<String,?>)Utils.doRequest(conn, SERVICE_SEARCH, "open-ils.search.metabib.record_to_descriptors", new Object[]{param});
- Integer metarecordID = Integer.parseInt((String)response.get("metarecord"));
-
+ Object obj = response.get("metarecord");
+ System.out.println(obj);
+ Integer metarecordID = Integer.parseInt(obj.toString());
HashMap<String,Integer> map = new HashMap<String, Integer>();
map.put("titleid", recordID);
--- /dev/null
+package org.evergreen.android.accountAccess.holds;
+
+import java.util.Calendar;
+
+import org.evergreen.android.R;
+import org.evergreen.android.accountAccess.AccountAccess;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
+import android.app.DatePickerDialog;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.text.format.DateFormat;
+import android.text.format.Time;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.DatePicker;
+import android.widget.EditText;
+import android.widget.TextView;
+
+public class HoldDetails extends Activity{
+
+
+ private TextView recipient;
+
+ private TextView title;
+
+ private TextView author;
+
+ private TextView physical_description;
+
+ private TextView screen_title;
+
+ private AccountAccess accountAccess;
+
+ private EditText expiration_date;
+
+ private Button updateHold;
+
+ private Button cancelHold;
+
+ private Button back;
+
+ private DatePickerDialog datePicker = null;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.hold_details);
+
+ final HoldRecord record = (HoldRecord) getIntent().getSerializableExtra("holdRecord");
+
+ accountAccess = AccountAccess.getAccountAccess();
+
+ recipient = (TextView) findViewById(R.id.hold_recipient);
+ title = (TextView) findViewById(R.id.hold_title);
+ author = (TextView) findViewById(R.id.hold_author);
+ physical_description = (TextView) findViewById(R.id.hold_physical_description);
+ screen_title = (TextView) findViewById(R.id.header_title);
+ cancelHold = (Button) findViewById(R.id.cancel_hold_button);
+ updateHold = (Button) findViewById(R.id.update_hold_button);
+ back = (Button) findViewById(R.id.back_button);
+
+ expiration_date = (EditText) findViewById(R.id.hold_expiration_date);
+
+ screen_title.setText("Place Hold");
+
+ recipient.setText(accountAccess.userName);
+ title.setText(record.title);
+ author.setText(record.author);
+ if(record.recordInfo != null)
+ physical_description.setText(record.recordInfo.physical_description);
+
+ System.out.println(record.title + " " + record.author);
+
+ back.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+
+ cancelHold.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+
+
+ Builder confirmationDialogBuilder = new AlertDialog.Builder(getApplicationContext());
+ confirmationDialogBuilder.setMessage(R.string.cancel_hold_dialog_message);
+
+ confirmationDialogBuilder.setNegativeButton(android.R.string.no, null);
+ confirmationDialogBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ System.out.println("Remove hold with id" + record.ahr.getInt("id"));
+ accountAccess.cancelHold(record.ahr);
+ }
+ });
+ confirmationDialogBuilder.create().show();
+
+ }
+ });
+
+ updateHold.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ //update new values
+ accountAccess.updateHold(record.ahr);
+ }
+ });
+
+ Calendar cal = Calendar.getInstance();
+ datePicker = new DatePickerDialog(this,
+ new DatePickerDialog.OnDateSetListener() {
+
+ public void onDateSet(DatePicker view, int year,
+ int monthOfYear, int dayOfMonth)
+ {
+ Time chosenDate = new Time();
+ chosenDate.set(dayOfMonth, monthOfYear, year);
+ long dtDob = chosenDate.toMillis(true);
+ CharSequence strDate = DateFormat.format("MMMM dd, yyyy", dtDob);
+ expiration_date.setText(strDate);
+ //set current date
+ }}, cal.get(Calendar.YEAR),cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
+
+ expiration_date.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ datePicker.show();
+ }
+ });
+
+ }
+
+}
--- /dev/null
+package org.evergreen.android.accountAccess.holds;
+
+import java.util.Date;
+
+import org.evergreen.android.globals.GlobalConfigs;
+import org.opensrf.util.OSRFObject;
+
+public class HoldItem {
+
+ //metarecord
+ public static final int M = 0;
+ //record
+ public static final int T = 1;
+ //volume
+ public static final int V = 2;
+ //issuance
+ public static final int I = 3;
+ //copy
+ public static final int C = 4;
+ //part
+ public static final int P = 5;
+
+ private Integer requestLibID = null;
+
+ private Integer pickupLibID = null;
+
+ public Integer holdType = null;
+ //id for target object
+ public Integer target = null;
+ public Date expire_time = null;
+
+ public String title = null;
+
+ public String author = null;
+
+
+ /* Hold status
+ * holdStatus == 4 => AVAILABLE
+ * holdStatus == 3 => WAITING
+ * holdStatus <= 3 => TRANSIT
+ */
+
+ //only for P types
+ public String part_label = null;
+
+ public Integer status = null;
+
+ public Boolean active = null;
+
+ public HoldItem(OSRFObject ahr){
+
+ this.target = ahr.getInt("target");
+ String type = ahr.getString("hold_type");
+
+ if(type.equals("M")){
+ holdType = M;
+ }else
+ if(type.equals("T")){
+ holdType = T;
+ }else
+ if(type.equals("V")){
+ holdType = V;
+ }else
+ if(type.equals("I")){
+ holdType = I;
+ }else
+ if(type.equals("C")){
+ holdType = C;
+ }else
+ if(type.equals("P"))
+ holdType = P;
+
+ this.expire_time = GlobalConfigs.parseDate(ahr.getString("expire_time"));
+
+ }
+ //based on status integer field retreive hold status in text
+ public String getHoldStatus(){
+
+ String holdStatus = "";
+
+ if(holdType == 7)
+ return "Suspended";
+ if(holdType == 4)
+ return "Available";
+ if(holdType == 3)
+ return "Waiting";
+ if(holdType < 3)
+ return "Transit";
+
+ return holdStatus;
+ }
+
+}
package org.evergreen.android.accountAccess.holds;
+import java.io.Serializable;
import java.util.Date;
import org.evergreen.android.globals.GlobalConfigs;
+import org.evergreen.android.searchCatalog.RecordInfo;
import org.opensrf.util.OSRFObject;
-public class HoldRecord {
+public class HoldRecord implements Serializable{
//metarecord
public static final int M = 0;
public Boolean active = null;
+ //must also be serializable
+ public OSRFObject ahr = null;
+ //record info with more etails
+ public RecordInfo recordInfo = null;
+
+
public HoldRecord(OSRFObject ahr){
this.target = ahr.getInt("target");
String type = ahr.getString("hold_type");
+ this.ahr = ahr;
+
if(type.equals("M")){
holdType = M;
}else
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
+import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
else
Toast.makeText(context, "You must be authenticated to retrieve circ records", Toast.LENGTH_LONG);
+
+ lv.setOnItemClickListener(new OnItemClickListener() {
+
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View arg1, int position,
+ long arg3) {
+ HoldRecord record = (HoldRecord) lv.getItemAtPosition(position);
+
+ Intent intent = new Intent(getApplicationContext(),HoldDetails.class);
+
+ intent.putExtra("holdRecord", record);
+
+ startActivity(intent);
+ }
+ });
}
package org.evergreen.android.accountAccess.holds;
+import java.util.Calendar;
+
import org.evergreen.android.R;
import org.evergreen.android.accountAccess.AccountAccess;
import org.evergreen.android.searchCatalog.RecordInfo;
import android.app.Activity;
+import android.app.DatePickerDialog;
import android.os.Bundle;
+import android.text.format.DateFormat;
+import android.text.format.Time;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
+import android.widget.DatePicker;
+import android.widget.EditText;
import android.widget.TextView;
public class PlaceHold extends Activity{
private AccountAccess accountAccess;
+ private EditText expiration_date;
+
private Button placeHold;
private Button cancel;
+ private DatePickerDialog datePicker = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
screen_title = (TextView) findViewById(R.id.header_title);
cancel = (Button) findViewById(R.id.cancel_hold);
placeHold = (Button) findViewById(R.id.place_hold);
+ expiration_date = (EditText) findViewById(R.id.hold_expiration_date);
screen_title.setText("Place Hold");
@Override
public void onClick(View v) {
- accountAccess.createHold(record_id);
+ //accountAccess.createHold(record_id);
+
+ accountAccess.getHoldPreCreateInfo(record_id, 4);
+ }
+ });
+
+
+
+ Calendar cal = Calendar.getInstance();
+ datePicker = new DatePickerDialog(this,
+ new DatePickerDialog.OnDateSetListener() {
+
+ public void onDateSet(DatePicker view, int year,
+ int monthOfYear, int dayOfMonth)
+ {
+ Time chosenDate = new Time();
+ chosenDate.set(dayOfMonth, monthOfYear, year);
+ long dtDob = chosenDate.toMillis(true);
+ CharSequence strDate = DateFormat.format("MMMM dd, yyyy", dtDob);
+ expiration_date.setText(strDate);
+ //set current date
+ }}, cal.get(Calendar.YEAR),cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
+
+ expiration_date.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ datePicker.show();
}
});
+
}
}
+++ /dev/null
-package org.open_ils;
-
-import java.util.Map;
-import java.util.HashMap;
-
-public class Event extends HashMap<String, Object> {
-
- public Event() {
- }
-
- public Event(Map<String, Object> map) {
- super(map);
- }
-
- public static Event parseEvent(Object map) {
- if( map != null && map instanceof Map) {
- Map m = (Map) map;
- if( m.containsKey("ilsevent") && m.containsKey("textcode"))
- return new Event(m);
- }
-
- return null;
- }
-
- public String getTextCode() {
- return (String) get("textcode");
- }
-
- public int getCode() {
- return Integer.parseInt((String) get("ilsevent"));
- }
-}
-
+++ /dev/null
-package org.open_ils;
-
-import org.opensrf.*;
-import org.opensrf.util.*;
-import org.open_ils.*;
-import org.open_ils.idl.*;
-import org.opensrf.util.*;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.io.IOException;
-
-
-public class Sys {
-
- private static IDLParser idlParser = null;
-
- /**
- * Initializes the connection to the OpenSRF network and parses the IDL file.
- * @param attrs A map of configuration attributes. Options include:<br/>
- * <ul>
- * <li>configFile - The OpenSRF core config file</li>
- * <li>configContext - The path to the config chunk in the config XML, typically "opensrf"</li>
- * <li>logProtocol - Currently supported option is "file".</li>
- * <li>logLevel - The log level. Options are 1,2,3, or 4 (error, warn, info, debug)</li>
- * <li>syslogFacility - For future use, when syslog is a supported log option</li>
- * <li>idlFile - The path to the IDL file. May be relative or absolute. If this option is
- * not provided, the system will ask the OpenSRF Settings server for the IDL file path.</li>
- * </ul>
- */
- public static void init(Map<String, String> attrs) throws ConfigException, SessionException, IOException, IDLException {
-
- String configFile = attrs.get("configFile");
- String configContext = attrs.get("configContext");
- String logProto = attrs.get("logProtocol");
- String logFile = attrs.get("logFile");
- String logLevel = attrs.get("logLevel");
- String syslogFacility = attrs.get("syslogFacility");
- String idlFile = attrs.get("idlFile");
-
-
- if(idlParser != null) {
- /** if we've parsed the IDL file, then all of the global setup has been done.
- * We just need to verify this thread is connected to the OpenSRF network. */
- org.opensrf.Sys.bootstrapClient(configFile, configContext);
- return;
- }
-
- /** initialize the logging infrastructure */
- if("file".equals(logProto))
- Logger.init(Short.parseShort(logLevel), new FileLogger(logFile));
-
- if("syslog".equals(logProto))
- throw new ConfigException("syslog not yet implemented");
-
- /** connect to the opensrf network. */
- org.opensrf.Sys.bootstrapClient(configFile, configContext);
-
- /** Grab the IDL file setting if not explicitly provided */
- if(idlFile == null) {
- SettingsClient client = SettingsClient.instance();
- idlFile = client.getString("/IDL");
- }
-
- /** Parse the IDL if necessary */
- idlParser = new IDLParser(idlFile);
- idlParser.parse();
- }
-}
-
+++ /dev/null
-package org.open_ils.idl;
-
-public class IDLException extends Exception {
- public IDLException(String info) {
- super(info);
- }
- public IDLException(String info, Throwable cause) {
- super(info, cause);
- }
-}
+++ /dev/null
-package org.open_ils.idl;
-
-public class IDLField {
-
- /** Field name */
- private String name;
-
- /** Where this field resides in the array when serilized */
- private int arrayPos;
-
- /** True if this field does not belong in the database */
- private boolean isVirtual;
-
- public void setName(String name) {
- this.name = name;
- }
- public void setArrayPos(int arrayPos) {
- this.arrayPos = arrayPos;
- }
- public void setIsVirtual(boolean isVirtual) {
- this.isVirtual = isVirtual;
- }
- public String getName() {
- return this.name;
- }
- public int getArrayPos() {
- return this.arrayPos;
- }
- public boolean getIsVirtual() {
- return this.isVirtual;
- }
-
- public void toXML(StringBuffer sb) {
- sb.append("\t\t\t<field name='");
- sb.append(name);
- sb.append("' ");
- sb.append(IDLParser.OILS_NS_OBJ_PREFIX);
- sb.append(":array_position='");
- sb.append(arrayPos);
- sb.append("' ");
- sb.append(IDLParser.OILS_NS_PERSIST_PREFIX);
- sb.append(":virtual='");
- sb.append(isVirtual);
- sb.append("'/>\n");
- }
-}
+++ /dev/null
-package org.open_ils.idl;
-
-
-public class IDLLink {
-
- /**The field on the IDLObject this link extends from */
- private String field;
- private String reltype;
- private String key;
- private String map;
- /**The IDL class linked to */
- private String IDLClass;
-
-
- public void setField(String field) {
- this.field = field;
- }
- public void setReltype(String reltype) {
- this.reltype = reltype;
- }
- public void setKey(String key) {
- this.key = key;
- }
- public void setMap(String map) {
- this.map = map;
- }
- public void setIDLClass(String IDLClass) {
- this.IDLClass = IDLClass;
- }
- public String getField() {
- return this.field;
- }
- public String getReltype() {
- return this.reltype;
- }
- public String getKey() {
- return this.key;
- }
- public String getMap() {
- return this.map;
- }
- public String getIDLClass() {
- return this.IDLClass;
- }
-}
-
+++ /dev/null
-package org.open_ils.idl;
-import java.util.HashMap;
-import java.util.Iterator;
-
-
-public class IDLObject {
-
- private String IDLClass;
- private String fieldMapper;
- private String controller;
- private String rptLabel;
- private HashMap<String, IDLField> fields;
- private HashMap<String, IDLLink> links;
-
- /** true if this is a virtual object (does not live in the database) */
- private boolean isVirtual;
-
- public IDLObject() {
- fields = new HashMap<String, IDLField>();
- links = new HashMap<String, IDLLink>();
- }
-
- public String getIDLClass() {
- return IDLClass;
- }
-
- public void addLink(IDLLink link) {
- links.put(link.getField(), link);
- }
-
- public void addField(IDLField field) {
- fields.put(field.getName(), field);
- }
-
- public IDLField getField(String name) {
- return (IDLField) fields.get(name);
- }
-
- public HashMap getFields() {
- return fields;
- }
-
-
- /**
- * Returns the link object found at the given field on
- * this IDLObject.
- */
- public IDLLink getLink(String fieldName) {
- return (IDLLink) links.get(fieldName);
- }
-
- public String getFieldMapper() {
- return fieldMapper;
- }
-
- public String getController() {
- return controller;
- }
-
- public String getRptLabel() {
- return rptLabel;
- }
- public boolean isVirtual() {
- return isVirtual;
- }
-
- public void setIDLClass(String IDLClass) {
- this.IDLClass = IDLClass;
- }
-
- public void setFieldMapper(String fm) {
- this.fieldMapper = fm;
- }
- public void setController(String controller) {
- this.controller = controller;
- }
- public void setRptLabel(String label) {
- this.rptLabel = label;
- }
- public void setIsVirtual(boolean isVirtual) {
- this.isVirtual = isVirtual;
- }
-
-
- public void toXML(StringBuffer sb) {
-
- sb.append("\t\t<fields>");
- Iterator itr = fields.keySet().iterator();
- IDLField field;
- while(itr.hasNext()) {
- field = fields.get((String) itr.next());
- field.toXML(sb);
- }
- sb.append("\t\t</fields>");
- }
-}
+++ /dev/null
-package org.open_ils.idl;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.opensrf.util.OSRFRegistry;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
-
-import android.util.Log;
-
-
-public class IDLParser {
-
- public static final String OILS_NS_BASE="http://opensrf.org/spec/IDL/base/v1";
- public static final String OILS_NS_OBJ="http://open-ils.org/spec/opensrf/IDL/objects/v1";
- public static final String OILS_NS_OBJ_PREFIX="oils_obj";
- public static final String OILS_NS_PERSIST="http://open-ils.org/spec/opensrf/IDL/persistence/v1";
- public static final String OILS_NS_PERSIST_PREFIX="oils_persist";
- public static final String OILS_NS_REPORTER="http://open-ils.org/spec/opensrf/IDL/reporter/v1";
- public static final String OILS_NS_REPORTER_PREFIX="reporter";
-
- /** The source for the IDL XML */
- InputStream inStream;
- HashMap<String, IDLObject> IDLObjects;
- IDLObject current;
- private int fieldIndex;
-
- /** If true, we retain the full set of IDL objects in memory. This is true by default. */
- private boolean keepIDLObjects;
-
- private int parsedObjectCount;
-
- public IDLParser() {
- IDLObjects = new HashMap<String, IDLObject>();
- keepIDLObjects = true;
- parsedObjectCount = 0;
- fieldIndex = 0;
- }
-
- public IDLParser(String fileName) throws IOException {
- this(new FileInputStream(fileName));
- }
-
- public IDLParser(InputStream inStream) {
- this();
- this.inStream = inStream;
- }
-
-
- /**
- * Parses the IDL XML
- */
- public void parse() throws IOException, IDLException {
-
- try {
- //XMLInputFactory factory = XMLInputFactory.newInstance();
-
- XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
- factory.setNamespaceAware(true);
- XmlPullParser xpp = factory.newPullParser();
-
- xpp.setInput(this.inStream,null );
- int eventType = xpp.getEventType();
-
- /** disable as many unused features as possible to speed up the parsing */
- /*
- factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
- factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
- factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
- factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);
- factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
- */
-
- /** create the stream reader */
-
- while(eventType != XmlPullParser.END_DOCUMENT) {
- /** cycle through the XML events */
-
- // eventType = reader.next();
-
- switch(eventType) {
-
- case XmlPullParser.START_TAG:
- handleStartElement(xpp);
- break;
-
- case XmlPullParser.END_TAG:
- handleEndElement(xpp);
- break;
- }
- eventType = xpp.next();
- }
-
- } catch(XmlPullParserException se) {
- throw new IDLException("Error parsing IDL XML", se);
- }
- }
-
- /**
- * Returns the IDLObject with the given IDLClass
- */
- public IDLObject getObject(String IDLClass) {
- return (IDLObject) IDLObjects.get(IDLClass);
- }
-
- /**
- * Returns the full set of IDL objects as a hash from classname to object.
- * If keepIDLObjects is false, the map will be empty.
- */
- public HashMap<String, IDLObject> getIDLObjects() {
- return IDLObjects;
- }
-
- /**
- * Returns the number of parsed objects, regardless of the keepIDLObjects setting.
- */
- public int getObjectCount() {
- return parsedObjectCount;
- }
-
-
- public void handleStartElement(XmlPullParser reader) {
-
- if(!OILS_NS_BASE.equals(reader.getNamespace())) return;
- String localpart = reader.getName();
-
- if( "class".equals(localpart) ) {
- fieldIndex = 0;
- current = new IDLObject();
- current.setIDLClass(reader.getAttributeValue(null, "id"));
- current.setController(reader.getAttributeValue(null, "controller"));
- String persist = reader.getAttributeValue(OILS_NS_PERSIST, "virtual");
- current.setIsVirtual("persist".equals(reader.getAttributeValue(OILS_NS_PERSIST, "virtual")));
- return;
- }
-
- if( "field".equals(localpart) ) {
- IDLField field = new IDLField();
- field.setName(reader.getAttributeValue(null, "name"));
- field.setArrayPos(fieldIndex++);
- field.setIsVirtual("true".equals(reader.getAttributeValue(OILS_NS_PERSIST, "virtual")));
- current.addField(field);
- //Log.d("parser","Field " + localpart + " " + field );
- }
-
- if( "link".equals(localpart) ) {
- IDLLink link = new IDLLink();
- link.setField(reader.getAttributeValue(null, "field"));
- link.setReltype(reader.getAttributeValue(null, "reltype"));
- link.setKey(reader.getAttributeValue(null, "key"));
- link.setMap(reader.getAttributeValue(null, "map"));
- link.setIDLClass(reader.getAttributeValue(null, "class"));
- current.addLink(link);
- }
- }
-
- public void handleEndElement(XmlPullParser reader) throws IDLException {
-
- if(!OILS_NS_BASE.equals(reader.getNamespace())) return;
- String localpart = reader.getName();
-
- if("class".equals(localpart)) {
-
- if(keepIDLObjects)
- IDLObjects.put(current.getIDLClass(), current);
-
- HashMap fields = current.getFields();
- String fieldNames[] = new String[fields.size()];
-
- for(Iterator itr = fields.keySet().iterator(); itr.hasNext(); ) {
- String key = (String) itr.next();
- IDLField field = (IDLField) fields.get(key);
- try {
- fieldNames[ field.getArrayPos() ] = field.getName();
- } catch(ArrayIndexOutOfBoundsException E) {
- String msg = "class="+current.getIDLClass()+";field="+key+
- ";fieldcount="+fields.size()+";currentpos="+field.getArrayPos();
- throw new IDLException(msg, E);
- }
- }
-
- OSRFRegistry.registerObject(
- current.getIDLClass(), OSRFRegistry.WireProtocol.ARRAY, fieldNames);
-
- parsedObjectCount++;
-
- current = null;
- }
- }
-
-
- public String toXML() {
- StringBuffer sb = new StringBuffer();
- Set keys = IDLObjects.keySet();
- Iterator itr = IDLObjects.keySet().iterator();
- String IDLClass;
- IDLObject obj;
- while(itr.hasNext()) {
- IDLClass = (String) itr.next();
- obj = IDLObjects.get(IDLClass);
- obj.toXML(sb);
- }
- return sb.toString();
- }
-}
-
-
-
-
-
-
+++ /dev/null
-package org.open_ils.test;
-import org.open_ils.idl.*;
-import org.opensrf.*;
-import org.opensrf.util.*;
-
-public class TestIDL {
- public static void main(String args[]) throws Exception {
- String idlFile = "fm_IDL.xml";
- IDLParser parser = new IDLParser(idlFile);
- parser.parse();
- //System.out.print(parser.toXML());
-
- OSRFObject bre = new OSRFObject("bre");
- bre.put("id", new Integer(1));
- bre.put("isnew", new Boolean(false));
- bre.put("isdeleted", new Boolean(true));
-
-
- System.out.println(bre);
- System.out.println(new JSONWriter(bre).write());
-
-
- }
-}
+++ /dev/null
-package org.open_ils.test;
-import org.open_ils.util.Utils;
-import org.open_ils.Event;
-import org.opensrf.*;
-import java.util.Map;
-import java.util.HashMap;
-
-
-public class TestLogin {
- public static void main(String args[]) {
- try {
-
- if(args.length < 3) {
- System.err.println("usage: java org.open_ils.test.TestLogin <opensrf_config> <username> <password>");
- return;
- }
-
- Sys.bootstrapClient(args[0], "/config/opensrf");
- Map<String,String> params = new HashMap<String,String>();
- params.put("username", args[1]);
- params.put("password", args[2]);
- Event evt = Utils.login(params);
- System.out.println(evt);
- } catch(Exception e) {
- System.err.println(e);
- }
- }
-}
-
+++ /dev/null
-package org.open_ils.util;
-import org.open_ils.*;
-import org.opensrf.*;
-import org.opensrf.util.*;
-import java.util.Map;
-import java.util.HashMap;
-import java.security.MessageDigest;
-
-public class Utils {
-
- /**
- * Logs in.
- * @param params Login arguments, which may consist of<br/>
- * username<br/>
- * barcode - if username is provided, barcode will be ignored<br/>
- * password<br/>
- * workstation - name of the workstation where the login is occuring<br/>
- * type - type of login, currently "opac", "staff", and "temp"<br/>
- * org - optional org ID to provide login context when no workstation is used.
- * @return An Event object. On success, the event 'payload' will contain
- * 'authtoken' and 'authtime' fields, which represent the session key and
- * session inactivity timeout, respectively.
- */
- public static Event login(Map params) throws MethodException {
-
- Map<String, String> initMap = new HashMap<String, String>();
- String init = (params.get("username") != null) ?
- params.get("username").toString() : params.get("barcode").toString();
- System.out.println("Here");
-
- Object resp = ClientSession.atomicRequest(
- "open-ils.auth",
- "open-ils.auth.authenticate.init", new Object [] {initMap});
- System.out.println("Here");
- /** see if the server responded with some type of unexpected event */
-
- Event evt = Event.parseEvent(resp);
- if(evt != null) return evt;
-
- params.put("password", md5Hex(resp + md5Hex(params.get("password").toString())));
-
- resp = ClientSession.atomicRequest(
- "open-ils.auth",
- "open-ils.auth.authenticate.complete", new Object[]{params});
-
- return Event.parseEvent(resp);
- }
-
-
- /**
- * Generates the hex md5sum of a string.
- * @param s The string to md5sum
- * @return The 32-character hex md5sum
- */
- public static String md5Hex(String s) {
- StringBuffer sb = new StringBuffer();
- MessageDigest md;
- try {
- md = MessageDigest.getInstance("MD5");
- } catch(Exception e) {
- return null;
- }
-
- md.update(s.getBytes());
- byte[] digest = md.digest();
- for (int i = 0; i < digest.length; i++) {
- int b = digest[i] & 0xff;
- String hex = Integer.toHexString(b);
- if (hex.length() == 1) sb.append("0");
- sb.append(hex);
- }
- return sb.toString();
- }
-}
-
-
-