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

📄 stylesheet.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="org.ofbiz.entity.util.SequenceUtil" %>


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

<form method="post" action="<ofbiz:url>/styleSheet</ofbiz:url>" >
<%

   String ENTITY = "UiUserTemplate";
   String STYLE = "UiStyleTemplate";
   String setAction = "";
   String action = "";

   ModelEntity entity = delegator.getModelEntity(ENTITY);
   ModelEntity entityStyle = delegator.getModelEntity(STYLE);

   //***************************************************
   // Find the user login in the style sheet preferences
   //***************************************************

   String myStyleLogin = userLogin.getString("userLoginId");
   HashMap hashMapMyStyle = new HashMap();
   hashMapMyStyle.put("userLoginId", myStyleLogin);
   GenericPK genericPk = new GenericPK(entity, hashMapMyStyle);
   GenericEntity myStyleInfo = delegator.findByPrimaryKey(genericPk);


   //***************************************************
   // Determine if we are adding or updating
   //***************************************************

   String myPrefLogin = myStyleInfo.getString("userLoginId");
   String setStyleSheetId = myStyleInfo.getString("styleSheetId");

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

   if( myPrefLogin != null){
		//actions=search, update, create
		setAction = "update";
   } else {
		setAction = "create";
   }

    //handle creating an action
   if(action.equals("create")){
     GenericValue genericValue = new GenericValue(entity);
     genericValue.setDelegator(delegator);
     Enumeration params = request.getParameterNames();
     while(params.hasMoreElements()){
       String pName = (String)params.nextElement();
		if(!pName.equals("sytleAction")
			&& !pName.equals("styleSheetDropDown")
			&& !pName.equals("styleAction")
			&& !pName.equals("test") ) {
			genericValue.set(pName, request.getParameter(pName));
		}
     }
   delegator.create(genericValue);
   //response.sendRedirect("<ofbiz:url>/styleSheet</ofbiz:url>");
  }


  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("sytleAction")
		&& !pName.equals("styleSheetDropDown")
		&& !pName.equals("styleAction")
		&& !pName.equals("test") ) {
       //%><table><tr><td><%
       //  out.write(pName);
       //  out.write(" / ");
       //  out.write( request.getParameter(pName) );
       //%></td></tr></table><%
         genericValue.set(pName, request.getParameter(pName));
       }
     }
     delegator.store(genericValue);
     //response.sendRedirect("<ofbiz:url>/styleSheet</ofbiz:url>");
  }

%>
     <!-- title table -->
     <table width="100%" height="30"><tr><td><div class="head1">Custom Colors</div></td></tr></table>


     <input type="hidden" value="<%=setAction%>" name="styleAction" >
	 <input type="hidden" value="<%=request.getParameter("styleAction")%>" name="test" >
      <table width='100%' class=viewOneHeader>
       <tr>
       <td width='100%' height='100%'>
         <table class=viewOneHeader>
           <tr >
             <td colspan="2">Select Style Sheet </td>
           </tr>


            <%
            String getStyleSheetId = request.getParameter("styleSheetId");
            HashMap statusProps = new HashMap();
			statusProps.put("NAME", "styleSheetId");
			statusProps.put("VALUE_FIELD", "styleSheetId" );
			statusProps.put("DISPLAY_FIELD", "styleSheetName" );
			if ( getStyleSheetId != null ){
				statusProps.put("SELECTED", getStyleSheetId);
			} else {
				statusProps.put("SELECTED", setStyleSheetId);
			}
			ArrayList order = new ArrayList();
			order.add("styleSheetName");
			String styleSheetDropDown = buildDropDown(delegator.findAll("UiStyleTemplate", order), statusProps );

            %>

            <tr>
			<td class="viewOneLabel">Style Sheet</td>
			<td class="viewOneField"><%=styleSheetDropDown%></td><!-- status -->
			</tr>

            <%
            ModelField currField;
            Iterator ix = entity.getFieldsIterator();
            while(ix.hasNext()){
            currField = (ModelField)ix.next();
            if(!currField.name.equals("createdBy") ||
               !currField.name.equals("createdDate") ||
               !currField.name.equals("modifiedBy") ||
               !currField.name.equals("modifiedDate") ) {
               if(!currField.name.equals("styleSheetId") ) {
           %>
            <tr>
                <td class=viewOneLabel><%=formatJavaString(currField.name)%>
                </td>
                <td><input type="text" name="<%=currField.name%>" value="<%=myStyleInfo.getString(currField.name)%>" >
                </td>
            </tr>
            <%	} %>
            <% } %>
            <%} %>
            <tr>
                <td></td><td><input type="submit" value="Set Style" ></td>
            </tr>
           </table>
         </td></tr></table>
    </td>
    <td valign="top">
    </td>
  </tr>

</table>
</form>

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

⌨️ 快捷键说明

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