⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accountpopup.jsp

📁 国外的一套开源CRM
💻 JSP
字号:
<%@ include file="/includes/header.jsp" %>
<%@ include file="/includes/uiCompositeSectionFunctions.js" %>
<%@ page import="com.sourcetap.sfa.ui.UIScreenSection" %>
<%@ page import="com.sourcetap.sfa.ui.UIWebUtility" %>

<jsp:useBean id="accountEventProcessor" class="com.sourcetap.sfa.account.AccountEventProcessor" scope="application" />
<jsp:useBean id="accountWebEventProcessor" class="com.sourcetap.sfa.account.AccountWebEventProcessor" scope="application" />
<jsp:useBean id="contactEventProcessor" class="com.sourcetap.sfa.contact.ContactEventProcessor" scope="application" />
<jsp:useBean id="contactWebEventProcessor" class="com.sourcetap.sfa.contact.ContactWebEventProcessor" scope="application" />
<jsp:useBean id="activityEventProcessor" class="com.sourcetap.sfa.activity.ActivityEventProcessor" scope="application" />
<jsp:useBean id="activityWebEventProcessor" class="com.sourcetap.sfa.activity.ActivityWebEventProcessor" scope="application" />
<jsp:useBean id="opportunityEventProcessor" class="com.sourcetap.sfa.opportunity.OpportunityEventProcessor" scope="application" />
<jsp:useBean id="opportunityWebEventProcessor" class="com.sourcetap.sfa.opportunity.OpportunityWebEventProcessor" scope="application" />

<!-- Resize the window -->

<SCRIPT>
 function preSubmitComposite(formObj) {
  // Check required fields on the account.
  if (verifyRequiredAccountHeader(formObj)==false) {return false;}

  var vContactTR = document.all.item("contactTR");
  if (vContactTR!=null && vContactTR.style.display!="none") {
   // Contact section is visible.  Validate the contact.
   if (verifyRequiredContactHeader(formObj)==false) {return false;}
  }

  var vActivityTR = document.all.item("activityTR");
  if (vActivityTR!=null && vActivityTR.style.display!="none") {
   // Activity section is visible.  Validate the activity.
   if (verifyRequiredActivityHeader(formObj)==false) {return false;}
  }

  var vOpportunityTR = document.all.item("opportunityTR");
  if (vOpportunityTR!=null && vOpportunityTR.style.display!="none") {
   // Activity section is visible. Validate the activity.
   if (verifyRequiredOpportunityHeader(formObj)==false) {return false;}
  }
  return true;
 }
 function initializeScreen(aAction) {

  window.resizeTo(850, 750);
  vFormObj = document.forms.item("<%=UIWebUtility.HTML_COMPOSITE_FORM_NAME%>");
  
  // Set focus to the first field on the screen unless it is in read-only mode.
  if (aAction=="<%=UIScreenSection.ACTION_SHOW_INSERT%>" || aAction=="<%=UIScreenSection.ACTION_SHOW_UPDATE%>") {
   vFormObj.all("<%=UIWebUtility.getParamName("", "AccountHeader", "Account", "stockSymbol", 0)%>").focus()
  }

  // If inserting a new account, hide the account search boxes on the contact, activity, and opportunity sections,
  // and put a dummy value in them so required field validation will pass.  Account IDs will be filled in by
  // the event processor.
  if (aAction=="<%=UIScreenSection.ACTION_SHOW_INSERT%>") {

   // Set Account ID on Contact
   vFieldObj = vFormObj.all("<%=UIWebUtility.getParamName("", "ContactHeader", "Contact", "accountId", 0)%>");
   vFieldObj.value="<new account>";
   vFieldObj.disabled=true;

   // Set Account ID on Activity.  ActivityEventProcessor sets the initial account ID, so first convert from select to text box, then disable it
   vFieldObj = vFormObj.all("<%=UIWebUtility.getParamName("", "ActivityHeader", "Activity", "accountId", 0)%>");
   forceSearchAgain(vFieldObj,vFormObj);
   vFieldObj = vFormObj.all("<%=UIWebUtility.getParamName("", "ActivityHeader", "Activity", "accountId", 0)%>");
   vFieldObj.value="<new account>";
   vFieldObj.disabled=true;

   // Set Account ID on Opportunity
   vFieldObj = vFormObj.all("<%=UIWebUtility.getParamName("", "OpportunityHeader", "Deal", "accountId", 0)%>");
   vFieldObj.value="<new account>";
   vFieldObj.disabled=true;

   // Set contact type to Primary.
//   vFieldObj = vFormObj.all("<%=UIWebUtility.getParamName("", "ContactHeader", "Contact", "contactTypeId", 0)%>");
//   vFieldObj.value="primary";

   // Set opportunity type to New Business.
   vFieldObj = vFormObj.all("<%=UIWebUtility.getParamName("", "OpportunityHeader", "Deal", "dealTypeId", 0)%>");
   vFieldObj.value="1";

   // Set opportunity stage to Target.
//   vFieldObj = vFormObj.all("<%=UIWebUtility.getParamName("", "OpportunityHeader", "Deal", "stageId", 0)%>");
//   vFieldObj.value="1";

   // Set opportunity status to Prospect.
//   vFieldObj = vFormObj.all("<%=UIWebUtility.getParamName("", "OpportunityHeader", "Deal", "dealStatusId", 0)%>");
//   vFieldObj.value="50";

  }
 }
function copyValues(target, value){
	var targetMailAddress = document.all.item("ContactHeader_Address_mailingAddress_0");
	var targetCity = document.all.item("ContactHeader_Address_city_0");
	var targetState = document.all.item("ContactHeader_Address_state_0");
	var targetZip = document.all.item("ContactHeader_Address_zip_0");
	var targetCountry = document.all.item("ContactHeader_Address_country_0");

	var sourceMailAddress = document.all.item("AccountHeader_Address_mailingAddress_0");
	var sourceCity = document.all.item("AccountHeader_Address_city_0");
	var sourceState = document.all.item("AccountHeader_Address_state_0");
	var sourceZip = document.all.item("AccountHeader_Address_zip_0");
	var sourceCountry = document.all.item("AccountHeader_Address_country_0");

	targetMailAddress.value = sourceMailAddress.value;
	targetCity.value = sourceCity.value;
	targetState.value = sourceState.value;
	targetZip.value = sourceZip.value;
	targetCountry.value = sourceCountry.value;

   toggleSection(target,value)
}
</SCRIPT>

<%
 String action = "";
 if (request.getParameter("action")!=null) {
  action = request.getParameter("action");
 }
 String screenMode = UIScreenSection.ACTION_SHOW_UPDATE;

 if 	(
 			action.equals(UIScreenSection.ACTION_SHOW_INSERT) ||
			(
				action.equals(UIScreenSection.ACTION_BUTTON) &&
				request.getParameter("newButton.x")!=null ||
				(
					request.getParameter("buttonAction")!=null &&
					request.getParameter("buttonAction").equals("New")
				)
			)
		)
	{
		screenMode = UIScreenSection.ACTION_SHOW_INSERT;
	}

%>
<BODY ONLOAD="initializeScreen('<%=action%>'); ">
<FORM METHOD="post" NAME="<%=UIWebUtility.HTML_COMPOSITE_FORM_NAME%>" ACTION="/sfa/control/accountPopup" TARGET="popupWindow">
<% if (action.equals(UIScreenSection.ACTION_INSERT)) { %>
 <INPUT TYPE="hidden" NAME="action" VALUE="<%=UIScreenSection.ACTION_UPDATE%>">
<% } else { %>
 <INPUT TYPE="hidden" NAME="action" VALUE="<%=UIScreenSection.ACTION_INSERT%>">
<% } %>
 <TABLE ID="compositeTable" NAME="compositeTable" CLASS="freeFormSectionTitleTable">
  <TR NAME="accountTR">
   <TD WIDTH=100%>

<!-- Display the Account Section and process events. -->
<%
try {
	out.write(
		accountWebEventProcessor.processEvents(
			"ACCOUNT",
			"AccountHeader",
			userInfo,
			request,
			response,
			delegator,
			accountEventProcessor,
			uiCache,
			true,
			0)
		);
} catch (Exception e) {
	out.write("Error processing account: " + e.getLocalizedMessage());
	return;
}
%>

   </TD>
  </TR>

  <!-- Display the Contact Section and process events. -->
<% if (screenMode.equals(UIScreenSection.ACTION_SHOW_INSERT) || request.getParameter("showContactCheckBox")!=null) { %>

 <% if (screenMode.equals(UIScreenSection.ACTION_SHOW_INSERT)) { %>

  <TR NAME="contactCheckboxTR">
   <TD>
    <LABEL ID="showContactLabel" FOR="showContactCheckBox">
     <INPUT TYPE="checkbox" NAME="showContactCheckBox" ID="showContactCheckBox" TABINDEX="1000" onClick="copyValues('contactTR',this.checked);">
     Add a contact
    </LABEL><BR>
   </TD>
  </TR>
  <TR NAME="contactTR" ID="contactTR" STYLE="display: none">
 <% } else { %>
  <TR NAME="contactTR" ID="contactTR" STYLE="display: block">
   <INPUT TYPE="hidden" NAME="showContactCheckBox" VALUE="on">
 <% } %>
   <TD>

<%
try {
	out.write(
		contactWebEventProcessor.processEvents(
			"CONTACT",
			"ContactHeader",
			userInfo,
			request,
			response,
			delegator,
			contactEventProcessor,
			uiCache,
			true,
			1000)
		);
} catch (Exception e) {
	out.write("Error processing contact: " + e.getLocalizedMessage());
	return;
}
%>
   </TD>
  </TR>
<% } %>

  <!-- Display the Activity Section and process events. -->
<% if (screenMode.equals(UIScreenSection.ACTION_SHOW_INSERT) || request.getParameter("showActivityCheckBox")!=null) { %>

 <% if (screenMode.equals(UIScreenSection.ACTION_SHOW_INSERT)) { %>
  <TR NAME="activityCheckboxTR">
   <TD>
    <LABEL ID="showActivityLabel" FOR="showActivityCheckBox">
     <INPUT TYPE="checkbox" NAME="showActivityCheckBox" ID="showActivityCheckBox" TABINDEX="2000" onClick="toggleSection('activityTR',this.checked);">
     Add an activity
    </LABEL><BR>
   </TD>
  </TR>
  <TR NAME="activityTR" ID="activityTR" STYLE="display: none">
 <% } else { %>
  <TR NAME="activityTR" ID="activityTR" STYLE="display: block">
   <INPUT TYPE="hidden" NAME="showActivityCheckBox" VALUE="on">
 <% } %>
   <TD>

<%
try {
	out.write(
		activityWebEventProcessor.processEvents(
			"ACTIVITIES",
			"ActivityHeader",
			userInfo,
			request,
			response,
			delegator,
			activityEventProcessor,
			uiCache,
			true,
			2000)
		);
} catch (Exception e) {
	out.write("Error processing activity: " + e.getLocalizedMessage());
	return;
}
%>
   </TD>
  </TR>
<% } %>

  <!-- Display the Opportunity Section and process events. -->
<% if (screenMode.equals(UIScreenSection.ACTION_SHOW_INSERT) || request.getParameter("showOpportunityCheckBox")!=null) { %>

 <% if (screenMode.equals(UIScreenSection.ACTION_SHOW_INSERT)) { %>
  <TR NAME="opportunityCheckboxTR">
   <TD>
    <LABEL ID="showOpportunityLabel" FOR="showOpportunityCheckBox">
     <INPUT TYPE="checkbox" NAME="showOpportunityCheckBox" ID="showOpportunityCheckBox" TABINDEX="3000" onClick="toggleSection('opportunityTR',this.checked);">
     Add an opportunity
    </LABEL><BR>
   </TD>
  </TR>
  <TR NAME="opportunityTR" ID="opportunityTR" STYLE="display: none">
 <% } else { %>
  <TR NAME="opportunityTR" ID="opportunityTR" STYLE="display: block">
   <INPUT TYPE="hidden" NAME="showOpportunityCheckBox" VALUE="on">
 <% } %>
   <TD>

<%
try {
	out.write(
		opportunityWebEventProcessor.processEvents(
			"OPPORTUNITIES",
			"OpportunityHeader",
			userInfo,
			request,
			response,
			delegator,
			opportunityEventProcessor,
			uiCache,
			true,
			3000)
		);
} catch (Exception e) {
	out.write("Error processing opportunity: " + e.getLocalizedMessage());
	return;
}
%>
   </TD>
  </TR>
<% } %>

  <TR>
   <TD WIDTH=100%>
    <INPUT TYPE="submit" CLASS="button" NAME="compositeSaveButton" ID="compositeSaveButton" VALUE="Save" onClick="return preSubmitComposite(this.form)">
   </TD>
  </TR>
 </TABLE>
</FORM>

<%@ include file="/includes/footer.jsp" %>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -