<% /****************************************************************************** * Copyright (c) 2000-2004 e-Deal * * e-Deal S.A. * 55 rue Brillat Savarin * 75013 Paris * France * * T: +33 (0)1 53 80 80 30 * F: +33 (0)1 73 01 69 77 * http://www.e-deal.com * * La diffusion de ce code source sous quelque forme que ce soit sans * l'autorisation de E-DEAL est interdite. * * Vous êtes autorisés à modifier ce code source uniquement pour votre usage * propre et sous réserve que les mentions de copyright demeurent intactes. * * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour * responsable des dommages pouvant résulter de l'utilisation de ce code * source. * * ******************************************************************************/ %><%@page session="true" import="com.edeal.frontline.navigation.FlRequest,com.edeal.frontline.*,com.edeal.frontline.custom.*,java.util.*"%> <%@ page import="java.awt.CardLayout" %> <%@ page import="java.text.DecimalFormat" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl"%> <% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String lngID = FlLocale.getInstance(session).getLanguageID(); //si la langue dans fllocal est null alors français pas defaut if(lngID == null) { try { lngID = dico.getRefIdByCode("Lng", "Val", "fr_FR"); } catch (Exception ex) { } } //je recupére des param //id du ciblage en cours String Cr2Selection = null; try { Cr2Selection = Criteria2.getCr2Se2ID(); }catch (FieldNotInitializedException e){} Selection2Bean selection2Bean = null; try { selection2Bean = new Selection2Bean(Cr2Selection,session); }catch (AccessDeniedException e){} String id = null; //id du critére parent de la template : old idCr2 try { id = Criteria2.getID(); }catch (FieldNotInitializedException e){} boolean isEdit = id != null; String operationID = dico.getRefIdByCode("Cr2Ope","exist"); //c'est id de la condition type si je viens d'une condition type String idCond = null; //old idPattern try { idCond = Criteria2.getCr2Condition(); }catch (FieldNotInitializedException e){} String paramCFldID = "Condition|"+idCond; String paramObject = null; String paramObjectID = null; try { paramObjectID = Criteria2.getCr2FobID(); ObjectsBean objBean = new ObjectsBean(paramObjectID,context); paramObject = objBean.getObjSql(); }catch (FieldNotInitializedException e){} String paramGrpID = null; try { paramGrpID = Criteria2.getCr2ParentID(); }catch (FieldNotInitializedException e){} String paramAlias = null; try { paramAlias = Criteria2.getCr2Alias(); }catch (FieldNotInitializedException e){} String paramType="0"; // the template selection Selection2Bean Sel2Bean = new Selection2Bean(idCond, context); // retriving the root element String TemplateRoot = null; try { TemplateRoot = Sel2Bean.getSe2Cr2ID(); } catch (FieldNotInitializedException ex) {} boolean isblue = true; boolean isMultival = false; boolean isControledByRef = false; boolean isControledByFob = false; boolean isMultipleValues = false; boolean isBoolean = false; boolean isDate = false; boolean isDecimal = false; boolean isInteger = false; boolean isNumeric = false; boolean isText = false; boolean isFirstLoad= true; boolean _date= false; Vector vectChx = new Vector(); Vector listID = new Vector(); // for node agraggate clonning Vector listAID = new Vector(); //Ici on recupere la liste des critéres qui ne sont pas des noeuds d'agregat String[] fieldS = {"Cr2ID", "Cr2FobID", "Cr2FldID", "Cr2Ope", "Cr2TempName", "Cr2Chx", "Cr2IsTemplate"}; Vector list = new Vector(); if (isEdit) { String[][] querySEdit = {{"Cr2Se2ID = "+Utils.formatToSQL(context, Cr2Selection),"Cr2Se2IDold = "+Utils.formatToSQL(context,id),"Cr2CardOpe = null", "Cr2TempName <> null", "Cr2IsTemplate = 1"}}; list = Criteria2Bean.listSummary(session, fieldS, querySEdit); } else { String[][] queryS = {{"Cr2Se2ID = "+Utils.formatToSQL(context, idCond),"Cr2CardOpe = null", "Cr2TempName <> null", "Cr2IsTemplate = 1"}}; list = Criteria2Bean.listSummary(session, fieldS, queryS); } //Ici on recupere la liste des critéres qui sont des noeuds d'agregat String[] fieldA={"Cr2ID", "Cr2TempName", "Cr2CardOpe", "Cr2Card"}; Vector listA = new Vector(); if (isEdit) { String[][] queryAEdit={{"Cr2Se2ID = "+Utils.formatToSQL(context, Cr2Selection), "Cr2Se2IDold = "+Utils.formatToSQL(context,id), "Cr2CardOpe <> null", "Cr2TempName <> null", "Cr2IsTemplate = 1"}}; listA = Criteria2Bean.listSummary(session, fieldA, queryAEdit); } else { String[][] queryA={{"Cr2Se2ID = "+Utils.formatToSQL(context, idCond),"Cr2CardOpe <> null", "Cr2TempName <> null", "Cr2IsTemplate = 1"}}; listA = Criteria2Bean.listSummary(session, fieldA, queryA); } //on definit un boolean si la condition type contient au moins des critéres avec des trous boolean isVisible = true; int h = list.size(); int m = listA.size(); if (( h == 0 ) && (m == 0)) isVisible = false; //on les recupére de edit pour afficher la liste des objets dans template.. String SubGroup = null; boolean isSub = false; try { SubGroup = Criteria2.getCr2SubGroup(); isSub= SubGroup != null && !"null".equals(SubGroup); }catch (FieldNotInitializedException ex){} //on uilise le shéma xml pour recuperer la liste des objets à faire Vector VectObject = new Vector(); Vector VectObjectShadow = new Vector(); Vector objects = new Vector(); //ici on parse le xml est on construit la liste des objets String Model =null; try { Model = selection2Bean.getSe2Model(); } catch (FieldNotInitializedException ex) {} SelectionManager Selman= new SelectionManager(context,Model); Selman.parse(); SelectionManager.GroupNode groupNode = Selman.getResultGroup(); if(isSub){ SelectionManager.SubGroupNode subGR = Selman.getSubGroupById(SubGroup); objects = subGR.getVectObjects(); } else { objects = groupNode.getVectObjects(); } Vector subgroup = Selman.getResultSubGroup(); String label = null; try { label = Criteria2.getCr2TempName(); } catch (FieldNotInitializedException fnie) { } if (objects != null && objects.size()>0){ for (int i=0; i0){ for (int i=0; i e-DEAL CRM "> <% if (id != null) { %> <% } %>






<% boolean IsAgraggate = false; if (paramObject !=null) { ObjectsBean objetBean =null; try{ objetBean = dico.getTable("sql",paramObject); } catch (FrontlineException ex) { IsAgraggate = true; } if (objetBean != null){ Vector vectFields = dico.getTableFields("sql", paramObject, true, false); Vector Champs = new Vector(); for (int i = 0; i < vectFields.size(); i++) { FieldBean fldBean = (FieldBean) vectFields.elementAt(i); String fldID = null; try { fldID = fldBean.getID(); } catch (FieldNotInitializedException ex) {} String fldSQL = null; try { fldSQL = fldBean.getFldSql(); } catch (FieldNotInitializedException ex) {} boolean horsCible = false; try { horsCible = fldBean.isFldCriteria(); } catch (FieldNotInitializedException ex) {} if (!horsCible) { String fldDisplay = null; try { fldDisplay = fldBean.getFldDisplay(); } catch (FieldNotInitializedException ex) { fldDisplay = ""; } try { fldDisplay = Utils.getMessage(session, fldBean .getFldDisplayLabel(), false, true, fldDisplay); } catch (FieldNotInitializedException fnie) { } if ("".equals(fldDisplay)){ fldDisplay = fldSQL; } String[] Fields = {fldID,fldDisplay}; Champs.addElement(Fields); } } String[] FieldsStat = {"","------------------------"}; // liste des conditions types Champs.addElement(FieldsStat); String condition="1"; String[] fieldCond = {"Se2ID", "Se2Name"}; String[][] queryCond = {{"Se2Condition = "+Utils.formatToSQL(context, condition), "Se2Model:SmdObjID = "+Utils.formatToSQL(context, paramObjectID)}}; Vector listCond = Selection2Bean.listSummary(session, fieldCond, queryCond); if (listCond != null && listCond.size() > 0) { for (int i = 0; i < listCond.size(); i++) { Hashtable row = (Hashtable) listCond.elementAt(i); String conditionID = (String) row.get("Se2ID"); String conditionName = (String) row.get("Se2Name"); String[] Fields= {"Condition|"+conditionID,conditionName}; Champs.addElement(Fields); } } %> <% }//fin de objBean }//fin de paramaObject %>




<% if(isVisible) { %> <% //on passe au noueds d'agregat if (listA != null && listA.size() > 0) { for (int i = 0; i < listA.size(); i++) { Hashtable row1 = (Hashtable) listA.elementAt(i); String Cr2ID = (String) row1.get("Cr2ID"); int Cr2Card = -1; if(isEdit){ Number Card = (Number) row1.get("Cr2Card"); Cr2Card = Card.intValue(); } listAID.addElement(Cr2ID); String Label = (String) row1.get("Cr2TempName"); Label = Utils.getMessage(session, Label, Utils.getMessage(session, "L60E0", "")); %> "> <% isblue = !isblue; } } if (list != null && list.size() > 0) { for (int i = 0; i < list.size(); i++) { FieldBean fld = null; String fldType = null; isMultival = false; isControledByRef = false; isControledByFob = false; isMultipleValues = false; isBoolean = false; isDate = false; isDecimal = false; isInteger = false; isNumeric = false; isText = false; Hashtable row1 = (Hashtable) list.elementAt(i); String Cr2ID = (String) row1.get("Cr2ID"); if(isEdit){ vectChx =(Vector)row1.get("Cr2Chx"); } listID.addElement(Cr2ID); String Label = (String) row1.get("Cr2TempName"); Label = Utils.getMessage(session, Label, Utils.getMessage(session, "L60E0", "")); String op = (String) row1.get("Cr2Ope"); String field = (String) row1.get("Cr2FldID"); if(field != null) { fld = dico.getFieldByID(field); String opeDisp = (String)dico.getRefDisp(session, "Cr2Ope", op); try { fldType = dico.getRefCode("FldFltID", fld.getFldFltID()); } catch (FieldNotInitializedException ex) {}; try { isControledByRef = (fld.getFldTabID() != null); } catch (FieldNotInitializedException ex) {}; try { isControledByFob = (fld.getFldFobID() != null); } catch (FieldNotInitializedException ex) {}; if("BIT".equals(fldType)) { isBoolean = true; } else if("DATE".equals(fldType) || "TIME".equals(fldType) || "TIMESTAMP".equals(fldType)) { isDate = true; } else if("FLOAT|DOUBLE".equals(fldType) || "REAL".equals(fldType)) { isDecimal = true; isNumeric = true; } else if("INTEGER".equals(fldType) || "BIGINT".equals(fldType) || "SMALLINT".equals(fldType) || "DECIMAL|NUMERIC".equals(fldType) || "TINYINT".equals(fldType)) { isInteger = true; isNumeric = true; } else if("CHAR|VARCHAR|LONGVARCHAR|CLOB".equals(fldType)) { isText = true; } String opeID = dico.getRefIdByCode("Cr2Ope","in"); if(fld.isFldMultival()||op.equals(opeID)) { isMultipleValues = true; } %> <% } isblue = !isblue; // end if field }// end for }// end if %>
<%= Label %>
value="<%=Cr2Card%>" <%}%> style="width: 100%;text-align: right" onBlur="ctrlNumField(this, 'integer', '');">
<%= Label %>
<% if(isControledByFob) { String fldFob = null; try { fldFob = fld.getFldFobID(); }catch (FieldNotInitializedException ex) {} ObjectsBean ctlFob = null; if (fldFob != null) { ctlFob = dico.getTable("id", fldFob); if(isMultipleValues) { %> <fl:getMessage code="> <fl:getMessage code="> <%}}}%>
<% if(isControledByFob) { String fldFob = null; try { fldFob = fld.getFldFobID(); }catch (FieldNotInitializedException ex) {} ObjectsBean ctlFob = null; if (fldFob != null) { ctlFob = dico.getTable("id", fldFob); %> <% if(isMultipleValues) { %> <% } else { %> <% } %>
">
"> " style="width: 100%" readonly onfocus="this.blur();"> <fl:getMessage code="> <fl:getMessage code=">
<% } } else if(isControledByRef) { Vector vectRef = dico.getRefList(session, fld.getFldSql()); %> <% } else if(isDate) { String strDate = ""; String strTime = ""; if(vectChx.size() > 0) { java.util.Date date = Utils.formatDateFromWeb(session, (String)vectChx.firstElement()); strDate = Utils.formatToWebDate(session, date, true); strTime = Utils.formatToWebTime(session, date, true).substring(0, 5); } %> ');"> ';return true;" onMouseOut="window.status=' '; return true"> ');"> <% } else if(isNumeric || isText) { %> " size="40" style="<%= (isNumeric) ? "width:100%;text-align:right" : "width:100%;" %>"<% if(isNumeric) { %> onBlur="ctrlNumField(this, '<%= isDecimal ? "float" : "integer" %>', '');"<% } %>> <% if (isNumeric) { %> <% } else { %> <% } %> <% if(isMultipleValues) { %>
<% } } else if(isBoolean) { %> <% } %>
<% } else { //fin de is visible %>
<% } %>