}
ArrayList buttonList = new ArrayList();
String standardParams = "listType="+listType+"&listFor="+listFor+"&recordID="+recordId+"&recordName="+recordNameURL;
String parameters = "";
Button deleteButton = new Button("Delete", "delete", "vl_deleteList();", false);
if (listType.equals("Activity") || listType.equals("CompletedActivity")) {
if (listFor.equals("Entity"))
{
parameters = "?entityID="+recordId+"&entityName="+recordNameURL;
} else if (listFor.equals("Individual")) {
parameters = "?entityID="+parentId+"&entityName="+parentNameURL+"&individualID="+recordId+"&individualName="+recordNameURL;
} else if (listFor.equals("Opportunity")) {
parameters = "?entityID="+parentId+"&entityName="+parentNameURL+"oppID="+recordId+"oppName="+recordNameURL;
} else if(listFor.equals("Project")) {
parameters = "?ProjectID="+recordId+"&ProjectTitle="+recordNameURL+"&entityName="+parentNameURL+"&entityID="+parentId;
}
buttonList.add(new Button("New Activity", "new", "c_openWindow('/activities/activity_dispatch.do" + parameters.toString()+ "', 'sched_act', 780, 580, '');", false));
buttonList.add(deleteButton);
} else if (listType.equals("Individual")) {
if(listFor.equals("Entity")) {
parameters = "entityName="+recordNameURL+"&entityNo="+recordId;
} else if(listFor.equals("Opportunities")) {
parameters = "entityName="+parentNameURL+"&entityNo="+parentId;
}
buttonList.add(new Button("View", "view", "vl_viewList();", false));
buttonList.add(new Button("New Individual", "new", "c_openWindow('/contacts/new_individual.do?"+parameters+"', 'newIndividual', 729, 301, '');", false));
buttonList.add(deleteButton);
} else if(listType.equals("Address")) {
buttonList.add(new Button("New Address", "new", "c_goTo('/contacts/new_related_address.do?"+standardParams+"');", false));
buttonList.add(deleteButton);
} else if(listType.equals("ContactMethod")) {
buttonList.add(new Button("New Contact Method", "new", "c_goTo('/contacts/new_contact_method.do?"+standardParams+"');", false));
buttonList.add(deleteButton);
}else if(listType.equals("EmailHistory")) {
buttonList.add(new Button("Compose", "new", "c_openWindow('/email/compose.do','',720,585,'');", false));
} else if(listType.equals("Note")) {
parameters = "?TYPEOFOPERATION=ADD&bottomFrame=true";
if (listFor.equals("Opportunity")) {
parameters += "&" + standardParams;
} else if (listFor.equals("Individual")) {
parameters += "&entityname="+parentNameURL+"&entityid="+parentId+"&individualid="+recordId+"&individualname="+recordNameURL+"&"+standardParams;
} else if (listFor.equals("Entity")) {
parameters += "&entityname="+recordNameURL+"&entityid="+recordId+"&"+standardParams;
}
if (!listFor.equals("Projects")) { // for some reason currently you cannot create a new note on project details screen
buttonList.add(new Button("New Note", "new", "c_goTo('/notes/new_note.do"+parameters+"&TYPEOFOPERATION=ADD');", false));
}
buttonList.add(deleteButton);
} else if(listType.equals("Ticket")) {
if (listFor.equals("Individual")) {
parameters = "?individualname="+recordNameURL+"&individualid="+recordId+"&entityname="+parentNameURL+"&entityid="+parentId;
} else if(listFor.equals("Entity")) {
parameters = "?entityname="+recordNameURL+"&entityid="+recordId;
}
buttonList.add(new Button("New Ticket", "new", "c_openWindow('/support/new_ticket.do"+parameters+"','',715,445,'');", false));
buttonList.add(deleteButton);
} else if(listType.equals("Proposal")) {
if (listFor.equals("Individual")) {
parameters = "?individual="+recordNameURL+"&individualid="+recordId;
} else if (listFor.equals("Opportunities")) {
parameters = "?oppTitle="+recordNameURL+"&oppId="+recordId;
}else{
// hmm... for some reason, the related Proposals list for Opportunity detail has a bum listFor value.
parameters = "?oppTitle=" + recordNameURL + "&oppId=" + recordId;
}
buttonList.add(new Button("New Proposal", "new", "c_openWindow('/sales/new_proposal.do"+parameters+"', '', 715, 445, '');", false));
buttonList.add(deleteButton);
} else if(listType.equals("Opportunity")) {
if (listFor.equals("Entity")) {
parameters = "?entityname="+recordNameURL+"&entityid="+recordId;
} else if(listFor.equals("Individual")) {
parameters = "?individualname="+recordNameURL+"&individualid="+recordId+"&entityname="+parentNameURL+"&entityid="+parentId;
}
buttonList.add(new Button("New Opportunity", "new", "c_openWindow('/sales/new_opportunity.do"+parameters+"', '', 715, 445, '');", false));
buttonList.add(deleteButton);
} else if(listType.equals("Project")) {
if (listFor.equals("Entity")) {
parameters = "?entityname="+recordNameURL+"&entityid="+recordId;
} else if(listFor.equals("Individual")) {
parameters = "?contact="+recordNameURL+"&contactID="+recordId+"&entityname="+parentNameURL+"&entityid="+parentId;
}
buttonList.add(new Button("New Project", "new", "c_openWindow('/projects/new_project.do"+parameters+"', '', 715, 445, '');", false));
buttonList.add(deleteButton);
} else if(listType.equals("File")) {
parameters = "?BottomFile=true";
if (listFor.equals("Entity")) {
parameters += "&entityname="+recordNameURL+"&entityid="+recordId;
} else if(listFor.equals("Individual")) {
parameters += "&individualname="+recordNameURL+"&individualid="+recordId+"&entityname="+parentNameURL+"&entityid="+parentId;
} else if(listFor.equals("Project")) {
parameters += "&ProjectTitle="+recordNameURL+"&ProjectID="+recordId;
}
buttonList.add(new Button("New File", "new", "c_openWindow('/files/file_new.do"+parameters+"', '', 715, 445, '');", false));
buttonList.add(deleteButton);
} else if(listType.equals("Task")) {
parameters = "?projectname="+recordNameURL+"&projectid="+recordId;
buttonList.add(new Button("New Task", "new", "c_openWindow('/projects/new_task.do"+parameters+"', '', 730, 360, '');", false));
buttonList.add(deleteButton);
} else if(listType.equals("Timeslip")) {
parameters = "?projectname="+recordNameURL+"&projectid="+recordId;
buttonList.add(new Button("New Timeslip", "new", "c_openWindow('/projects/new_timeslip.do"+parameters+"', '', 730, 360, '');", false));
buttonList.add(deleteButton);
} else if(listType.equals("Contact")) {
parameters = "entityName="+parentNameURL+"&entityNo="+parentId;
buttonList.add(new Button("New Individual", "new", "c_openWindow('/contacts/new_individual.do"+parameters+"', '', 729, 301, '');", false));
buttonList.add(deleteButton);
} else if(listType.equals("Order")) {
buttonList.add(new Button("New Order", "new", "c_showMainWindow('/accounting/new_order.do', '', 729, 301, '');", false));
}
return buttonList;
}