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

📄 codetypedetail.jsp

📁 国外的一套开源CRM
💻 JSP
字号:
<%@ page import="org.ofbiz.entity.*" %>
<%@ page import="org.ofbiz.entity.model.*" %>
<%@ page import="java.lang.reflect.Method" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.Timestamp" %>
<%@ page import="org.ofbiz.entity.util.SequenceUtil" %>


<%@ include file="/includes/header.jsp" %>
<%@ include file="/includes/leftcolumn-codeType.jsp" %>

<%

   String ENTITY = "CodeType";
   String action = "";
   String codeTypeId = "";
   boolean update = false;
   String rowClass;
   int    rowNum;
   String val = "";

   ModelEntity entity = delegator.getModelEntity(ENTITY);

   if(request.getParameter("action") != null){
     //actions=search, update, create
     action = request.getParameter("action");
   }

   if(request.getParameter("codeTypeId") != null){
     codeTypeId = request.getParameter("codeTypeId");
   }

   if(action.equals("update")){
    GenericValue genericValue = new GenericValue(entity);
    genericValue.setDelegator(delegator);
    Enumeration params = request.getParameterNames();
    while(params.hasMoreElements()){
       String pName = (String)params.nextElement();
       if(!pName.equals("action") && !pName.equals("isVisible"))
         genericValue.set(pName, request.getParameter(pName));
     }
     // Handle the check boxes.
     if(request.getParameter("isVisible") != null && request.getParameter("isVisible").equalsIgnoreCase("on")){
       genericValue.set("isVisible", "Y");
     } else {
       genericValue.set("isVisible", "N");
     }
     delegator.store(genericValue);
  }

%>

<!-- title table -->
<table width="100%" height="30"><tr><td><div class="head1">Code Type Detail</div></td></tr></table>

<table width="100%" valign="top"><tr><td>
  <table border=0 width='100%' cellpadding='<%=headerBoxBorderWidth%>' cellspacing='0' class="viewOneHeader"><tr><td width='100%' height='100%'>
    <table border="0" width="100%" class="viewOneHeader"><tr>
      <td>
        Code Type Details
      </td>
      <td align="right">

        <% if(!action.equals("showUpdate")) { %>
          <a href="<ofbiz:url>/codeTypeDetail</ofbiz:url>?action=showUpdate&amp;codeTypeId=<%=codeTypeId%>">Update</a>
        <% } else {%>
          <a href="<ofbiz:url>/codeTypeDetail</ofbiz:url>?codeTypeId=<%=codeTypeId%>">Cancel Update</a>
        <% } %>
      </td></tr>
    </table>

    <table border="0" width="100%" class="viewOneBox">
      <form method="post" action="<ofbiz:url>/codeTypeDetail</ofbiz:url>" >
        <input type="hidden" value="update" name="action" >
          <% //display details
            HashMap hashMap = new HashMap();
            hashMap.put("codeTypeId", codeTypeId);
            GenericPK genericPk = new GenericPK(entity, hashMap);
            GenericValue codeTypeDetails = delegator.findByPrimaryKey(genericPk);
            String name = "";
%>
            <!-- Code Type ID -->
            <tr>
             <td  width="20%" class="viewOneLabel">Code Type ID</td>
             <td  width="30%" class="viewOneField">
                <% name="codeTypeId"; %>
                  <%=codeTypeDetails.getString(name)%>
             </td>

            <!-- Code Type Name -->
            <tr>
             <td  width="20%" class="viewOneLabel">Code Type Name</td>
             <td  width="30%" class="viewOneField">
                <% name="codeTypeName";
                  if(action.equals("showUpdate")) { %>
                  <input type="text" name="<%=name%>" value="<%=(String.valueOf(codeTypeDetails.get(name)) != null ? String.valueOf(codeTypeDetails.get(name)) : "") %>">
                <%} else {%>
                  <%=codeTypeDetails.getString(name)%>
                <%}%>
             </td>

            <!-- Code Type Description -->
            <tr>
            <td width="20%" class="viewOneLabel">Code Type Description</td>
            <td width="80%" colspan="3" class="viewOneField">
                <% name="codeTypeDescription";
                  if(action.equals("showUpdate")) { %>
                  <textarea  cols="60" rows="15" name="<%=name%>" ><%=(String.valueOf(codeTypeDetails.get(name)) != null ? String.valueOf(codeTypeDetails.get(name)) : "") %></textarea>
                <%} else {%>
                  <%=codeTypeDetails.getString(name)%>
                <%}%>
            </td>
            </tr>

            <!-- Is Active -->
            <tr>
			<td class="viewOneLabel">Active</td>
			<td class="viewOneField">
               <% name="isVisible";
                  if ( (codeTypeDetails != null) && (codeTypeDetails.get(name) != null ))
                    val = String.valueOf(codeTypeDetails.get(name));
                  else
                    val= "";
                  if(action.equals("showUpdate")) { %>
                   <input type="checkbox" name="<%=name%>" <%=( val != null && val.equals("Y") ? "CHECKED" : "") %> >
                <%} else {%>
                  <%=(val.equals("Y") ? "Yes" : "No" )%>
                <%}%>

             </td>
            </tr>

            <%if(action.equals("showUpdate")) {%>
              <tr><td colspan="2" align="right"><input type="submit" value="update" ></td></tr>
            <% } %>
      </form>
      </tr></table>
  </table>

  <!-- Codes List -->

  <table bgcolor="white" height="20"><tr><td></td></tr></table>
  <table width='100%' class=viewManyHeader><tr><td width='100%' height='100%'>
    <table width="100%" class=viewManyHeader><tr>
      <td>
        Codes
      </td>
      <td align="right">
        <a href="<ofbiz:url>/codeAdd</ofbiz:url>?codeTypeId=<%=codeTypeId%>">New Code</a>
      </td></tr>
    </table>
      <%
       HashMap codeMap = new HashMap();
       String searchString = codeTypeDetails.getString("codeTypeId");
       codeMap.put("codeTypeId", searchString);
       List codes = delegator.findByAnd("Code", codeMap, null);
       Iterator codeIterator = codes.iterator();
      %>
      <table width="640" class=viewManyHeaderLabel>
        <tr>
          <td width="20%">Code ID</td>
          <td width="40%">Code Value</td>
          <td width="8%">Active</td>
          <td width="8%">Visible</td>
          <td align="right">Action</td>
        </tr>
        <% rowNum = 0;
           while(codeIterator.hasNext()) {
              GenericValue codeDetails = (GenericValue)codeIterator.next();
              rowClass = (((rowNum++ % 2) != 0) ? "viewManyTR1" : "viewManyTR2");

        %>
        <tr class=<%=rowClass%> >
          <td><a href="<ofbiz:url>/codeDetail</ofbiz:url>?codeTypeId=<%=codeDetails.getString("codeTypeId")%>&amp;codeId=<%=codeDetails.getString("codeId")%>"><%=codeDetails.getString("codeId")%></a></td>
          <td><%=codeDetails.getString("codeValue")%></td>
          <td><%=String.valueOf(codeDetails.get("isVisible")).equals("Y") ? "Yes" : "No"%></td>
          <td><%=String.valueOf(codeDetails.get("isActive")).equals("Y") ? "Yes" : "No"%></td>
          <td align="right">
              <a href="<ofbiz:url>/codeDetail</ofbiz:url>?action=showUpdate&amp;codeTypeId=<%=codeDetails.getString("codeTypeId")%>&amp;codeId=<%=codeDetails.getString("codeId")%>">Edit</a><br>
          </td>
        </tr>
        <%
         }
        %>
       </table>
    </table>


   </td>
  </tr>
</table>


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

⌨️ 快捷键说明

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