Edit C:\galaxie\Back\galaxie\netbusiness\customformquestion\edit.jsp
<% /****************************************************************************** * Copyright (c) 2000-2005 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.*,java.util.*,java.text.*"%> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <jsp:useBean class="com.edeal.frontline.FormQuestionBean" id="FormQuestion" scope="request"/> <% 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(); FlLocale locale = FlLocale.getInstance(session); String id=null; try { id = FormQuestion.getID(); } catch (FieldNotInitializedException fnie) { } Vector listSelectedRef = null; String selectedRefStr = null; try{ listSelectedRef = (Vector)FormQuestion.getCustomProperty("FqtRefsDisp_"); selectedRefStr = Utils.implodeList(listSelectedRef, "|"); }catch(FieldNotInitializedException e){} Vector listRef2Init = null; String refToInitStr = null; try{ listRef2Init = (Vector)FormQuestion.getCustomProperty("FqtRefsInit_"); refToInitStr = Utils.implodeList(listRef2Init, "|"); }catch(FieldNotInitializedException e){} //Cette variable est utilisée pour le premier chargement de la page en création //Au 1er chargement nous trouvons: type = text libre et le champs taille zone String typeRefresh=null; if (id==null){ typeRefresh = flRequest.getRequestParameterOrAttribute("typeRefresh"); } String type=null; String idType=null; try{ idType = FormQuestion.getFqtType(); }catch(FieldNotInitializedException fnie){} if (idType != null && idType.length()>0){ if (idType.equals(dico.getRefIdByCode("FqtType", "REF"))){ type = "REF"; } else if (idType.equals(dico.getRefIdByCode("FqtType", "LST"))){ type = "LST"; } //Text Libre else if (idType.equals(dico.getRefIdByCode("FqtType", "FRE"))){ type = "FRE"; } } int seqNum = 0; try { seqNum = FormQuestion.getFqtSeqNum(); } catch (FieldNotInitializedException fnie) { seqNum = CounterFactory.getCounter(context , "FormQuestionNum"); } DecimalFormat df = FlLocale.getInstance(session).getDecimalFormat("0000"); //Type d'aafichage --> combo, checkbox String typeDisp=null; String idTypeDisp=null; try{ idTypeDisp = FormQuestion.getFqtDispType(); //dico.getRefIdByCode("FqtDispType", ) }catch(FieldNotInitializedException fnie){} if (idTypeDisp!=null && idTypeDisp.length()>0){ if (idTypeDisp.equals(dico.getRefIdByCode("FqtDispType", "RADIO"))){ typeDisp = "RADIO"; }else if (idTypeDisp.equals(dico.getRefIdByCode("FqtDispType", "CHECK"))){ typeDisp = "CHECK"; }else if (idTypeDisp.equals(dico.getRefIdByCode("FqtDispType", "COMBO"))){ typeDisp = "COMBO"; } } //Text Associé int associatedText = 0; try { associatedText = FormQuestion.getFqtAssociatedText(); } catch (FieldNotInitializedException fnie) {} int hasOther = 0; try { hasOther = FormQuestion.getFqtHasOther(); } catch (FieldNotInitializedException fnie) {} String labelcode = null; String msg = null; try { labelcode = (String)FormQuestion.getCustomProperty("FqtLabelCode_"); msg = Utils.getMessage(context,session, "fr_FR",labelcode, false, ""); msg = Utils.getMessage(session, labelcode, false, ""); } catch (FieldNotInitializedException fnie) { } %> <script type="text/javascript" language="javascript"> function doSubmit(){ return true; } function doRefresh(){ var f = document.forms[0]; var url = '<fl:link url="/refresh_customformquestion.fl"/>'; doExitConf = false; f.typeRefresh.value = 'Refresh'; f.action = url; f.submit(); } function doResetRefToInit(){ $('#FqtRefsInit_').val(''); $('#refs2Init').val(''); $('#refs2Init option').remove(); } function doResetRefvalues(){ if($('#refsselected').val() != ''){ $('#FqtRefsInit_').val(''); $('#FqtRefsDisp_').val(''); //$('#refs2Init').val(''); //$('#refs2Init option').remove(); $('#refsselected').val(''); $('#refsselected option').remove(); } } function doFqtRefTableChange(){ doResetRefvalues(); doRefresh(); } function doFqtDispTypeChange(){ doResetRefToInit(); doRefresh(); } function addKey(listsrc,listdest,input,dispType) { $('#' + listsrc + ' option:selected').each(function () { var refID = $(this).val(); var refName = $('#' + listsrc + ' option[value="'+ refID +'"]:selected').text(); if (refID != '' && !verifyList(refID,listdest)) { $('#' + listdest).append($('<option>', { value : refID }).text(refName)); } }); removeOpts('#' + listsrc); refreshListsAndInputs(listdest,input); } function addInitKeys(listsrc,listdest,input,dispType){ if(dispType == 'CHECK'){ $('#' + listsrc + ' option:selected').each(function () { var refID = $(this).val(); var refName = $('#' + listsrc + ' option[value="'+ refID +'"]:selected').text(); if (refID != '' && !verifyList(refID,listdest)) { $('#' + listdest).append($('<option>', { value : refID }).text(refName)); } }); }else{ $('#' + listsrc + ' option:selected').each(function () { var refID = $(this).val(); var refName = $('#' + listsrc + ' option[value="'+ refID +'"]').text(); var size = $('#' + listdest).length; if (refID != '' && !verifyList(refID,listdest)) { if(size == 0) $('#' + listdest).append($('<option>', { value : refID }).text(refName)); else { $('#' + listdest + ' option').remove(); $('#' + listdest).append($('<option>', { value : refID }).text(refName)); } } }); } refreshListsAndInputs(listdest,input); } function verifyList(refID,list){ var exist = false; $('#' + list + ' option').each(function () { var tempo = $(this).val(); if(tempo == refID) { exist = true; return exist; } }); return exist; } function removeOpts(selectBox) { $(selectBox + ' option:selected').remove(); } function refreshListsAndInputs(list,input){ var selectedRefs = ''; $('#' + list + " option").each(function () { selectedRefs += $(this).val() + "|"; }); $('#' + list).val(selectedRefs.substring(0, selectedRefs.length - 1)); $('#' + input).val(selectedRefs.substring(0, selectedRefs.length - 1)); } function deleteKey(listsrc,listdest,input,dispType){ $('#' + listsrc + ' option:selected').each(function () { var refID = $(this).val(); var refName = $('#' + listsrc + ' option[value="'+ refID +'"]:selected').text(); if (refID != '' && !verifyList(refID,listdest)) { $('#' + listdest).append($('<option>', { value : refID }).text(refName)); } }); removeOpts('#' + listsrc); refreshListsAndInputs(listdest,input); } function doSelectLabel(field) { window.open('<fl:link url="/select_label.fl?1=1"/>&field=' + field, 'select_label', 'width=1000,height=500,menubar=no,status=no,resizable=yes'); } function doRemoveLabel(field){ var f = window.document.forms[0]; if(field == 'FqtPostTextLabel_'){ f.lblFqtPostTextLabel_.value=''; f.FqtPostTextLabel_.value = ''; }else if(field == 'FqtPreTextLabel_'){ f.lblFqtPreTextLabel_.value=''; f.FqtPreTextLabel_.value = ''; }else if(field == 'FqtLabelCode_'){ f.lblFqtLabelCode_.value=''; f.FqtLabelCode_.value = ''; } } </script> <fl:form action="/save_customformquestion.fl" bean="FormQuestion"> <input type="hidden" id="FqtRefsDisp_" name="FqtRefsDisp_" value="<%= Utils.isEmpty(selectedRefStr) ? "" : selectedRefStr %>"/> <input type="hidden" id="FqtRefsInit_" name="FqtRefsInit_" value="<%= Utils.isEmpty(refToInitStr) ? "" : refToInitStr %>"/> <fl:bigTabs objectTitle="<%=Utils.getMessage(session, \"L63ED\", false, true, \"Question\")%>" ou="<%=\"/edit_formquestion.fl\"+ (id!=null ? \"?id=\"+id : \"\")%>"> <div> <table class="container" cellpadding="0"> <input type="hidden" name="typeRefresh" /> <tr> <td colspan="5"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td class="labelTitreFiche"> <fl:label field="FqtLabel" labelClassName="titreFiche"/> </td> <td class="fieldTitreFiche"> <fl:input property="FqtLabel"/> </td> </tr> </table> </td> </tr> <tr><td colspan="5" class="ligne_separation"/></tr> <tr> <td class="column2"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td class="dataLabel"><fl:label field="FqtLabelCode_"/></td> <td class="dataValue"> <div class="input fieldTable"> <table class="fieldTable" cellpadding="0"> <td class="principalText bigFieldPart"> <div class="fobLeftDiv"> <textarea name="lblFqtLabelCode_" id="lblFqtLabelCode_" class="input textarea" onFocus="this.blur();" style="width: 100%;"><%= labelcode == null ? "" : msg %></textarea> <input name="FqtLabelCode_" id="FqtLabelCode_" type="hidden" value="<%= labelcode != null ? labelcode : "" %>"> </div> </td> <td class="smallFieldPart"> <a id="selectFqtLabelCode_" href="javascript:doSelectLabel('FqtLabelCode_')"><img src="<fl:webapp/>/icons/ico/rechercher.gif" alt="" border="0"></a> <a href="javascript:doRemoveLabel('FqtLabelCode_')"><img src="<fl:webapp/>/icons/ico/supprimer.gif" alt="" border="0"></a> </td> </table> </div> </td> </tr> <fl:fieldEdit mandatoryMsgCode="L65B6" property="FqtType" onchange="doRefresh();" alt=" "/> <% if (("FRE".equals(type)||typeRefresh==null)&&!"LST".equals(type)&&!"REF".equals(type)){%> <fl:fieldEdit property="FqtInputSize"/> <%}else if ("REF".equals(type)){%> <fl:fieldEdit property="FqtRefTable" onchange="doRefresh();"/> <%}%> <fl:fieldEdit property="FqtHelpText" /> <%-- <fl:fieldEdit property="FqtPreTextLblID_" /> <fl:fieldEdit property="FqtPostTextLblID_" /> --%> <% if ("REF".equals(type)||("LST".equals(type))){%> <tr class="fieldline"> <td class="dataLabel"><fl:getMessage code="F604F" alt="Texte associé"/></td> <td class="dataValue"> <select name="FqtAssociatedText" onChange="doRefresh();" class="input select"> <option value="0" <%= associatedText == 0 ? "selected" : "" %> ><fl:getMessage code="L2006" alt="Non"/> <option value="20" <%= associatedText == 0 ? "" : "selected" %> ><fl:getMessage code="L2005" alt="Oui"/> </select> </td> </tr> <%}%> </table> </td> <td class="separation" ><div class="separation"></div></td> <td class="column2"> <table class="container" cellpadding="0"> <tr class="fieldline"> <td id="FqtSeqNum_label" class="dataLabel"> <div> <label for="FqtSeqNum" title="<fl:getMessage code="F202D" alt="Numéro"/>"><fl:getMessage code="F202D" alt="Numéro"/></label> </div> </td> <td id="FqtSeqNum_label" class="dataValue"> <div> <input id="FqtSeqNum" name="FqtSeqNum" type="hidden" value="<%= seqNum %>"><input id="lblFqtSeqNum" name="lblFqtSeqNum" type="text" value="<%= df.format((long)seqNum) %>" class="input number transRead" style="text-align: left" onfocus="this.blur();"> </div> </td> </tr> <%-- <fl:fieldEdit property="FqtCategory" alt=" "/> --%> <fl:fieldEdit property="FqtRequired" alt=" "/> <fl:fieldEdit property="FqtToBeValidated" alt=" "/> <% if ("REF".equals(type)||("LST".equals(type))){%> <fl:fieldEdit property="FqtDispType" onchange="doFqtDispTypeChange();"/> <%}%> <%if ("RADIO".equals(typeDisp)||"CHECK".equals(typeDisp)){%> <fl:fieldEdit property="FqtColumnsNb"/> <%}%> <%-- <fl:fieldEdit property="FqtStoreInObjID" alt=" "/> <fl:fieldEdit property="FqtPreTextLblID_" alt=" "/> --%> <% String label = null; try { label = (String)FormQuestion.getCustomProperty("FqtPreTextLabel_"); } catch (FieldNotInitializedException fnie) { } %> <tr class="fieldline"> <td class="dataLabel"><label for="selectFldDisplayLabel"><fl:getMessage code="FF226" alt="Texte pre-question"/></label></td> <td class="dataValue"> <div class="input fieldTable"> <table class="fieldTable" cellpadding="0"> <td class="principalText bigFieldPart"> <div class="fobLeftDiv"> <textarea name="lblFqtPreTextLabel_" id="lblFqtPreTextLabel_" class="input textarea" onFocus="this.blur();" style="width: 100%;"><%= label == null ? "" : Utils.getMessage(session,label, Utils.getMessage(session, "L60E0", "<non spécifié>")) %></textarea> <input name="FqtPreTextLabel_" id="FqtPreTextLabel_" type="hidden" value="<%= label != null ? label : "" %>"> </div> </td> <td class="smallFieldPart"> <a id="selectFqtPreTextLblID_" href="javascript:doSelectLabel('FqtPreTextLabel_')"><img src="<fl:webapp/>/icons/ico/rechercher.gif" alt="" border="0"></a> <a href="javascript:doRemoveLabel('FqtPreTextLabel_')"><img src="<fl:webapp/>/icons/ico/supprimer.gif" alt="" border="0"></a> </td> </table> </div> </td> </tr> <% String postlabel = null; try { postlabel = (String)FormQuestion.getCustomProperty("FqtPostTextLabel_"); } catch (FieldNotInitializedException fnie) { } %> <tr class="fieldline"> <td class="dataLabel"><label for="selectFldDisplayLabel"><fl:getMessage code="FF227" alt="Texte post-question"/></label></td> <td class="dataValue"> <div class="input fieldTable"> <table class="fieldTable" cellpadding="0"> <td class="principalText bigFieldPart"> <div class="fobLeftDiv"> <textarea name="lblFqtPostTextLabel_" id="lblFqtPostTextLabel_" class="input textarea" onFocus="this.blur();" style="width: 100%;"><%= postlabel == null ? "" : Utils.getMessage(session,postlabel, Utils.getMessage(session, "L60E0", "<non spécifié>")) %></textarea> <input name="FqtPostTextLabel_" id="FqtPostTextLabel_" type="hidden" value="<%= postlabel != null ? postlabel : "" %>"> </div> </td> <td class="smallFieldPart"> <a id="selectFqtPostTextLblID_" href="javascript:doSelectLabel('FqtPostTextLabel_')"><img src="<fl:webapp/>/icons/ico/rechercher.gif" alt="" border="0"></a> <a href="javascript:doRemoveLabel('FqtPostTextLabel_')"><img src="<fl:webapp/>/icons/ico/supprimer.gif" alt="" border="0"></a> </td> </table> </div> </td> </tr> </table> </td> </tr> <tr><td colspan="5" class="ligne_separation"/></tr> </table> <% if ("REF".equals(type)){ String fqtRefTable = null; try { fqtRefTable = FormQuestion.getFqtRefTable(); } catch (FieldNotInitializedException fnie) { } String refName=null; String refID=null; Vector listRef = null; String[] fields = {"RefID","RefTe1"}; String[][] query = {{"RefTabID = " + Utils.formatToSQL(context, fqtRefTable)}}; String[] orderBy = {"RefPos ASC"}; try{ listRef = RefValuesBean.listSummary(context, fields, query, orderBy); logger.info("listref" + listRef.toString()); }catch(FrontlineException fe){} if (listRef!=null){ %> <link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css"> <fl:smallTabs name="REFTabs"> <fl:sTab id="REF" title="<%= Utils.getMessage(session, \"L6019\", \"Valeurs de référence\") %>"> <table class="container" cellpadding="0"> <tr> <td class="column2"> <table class="container" cellpadding="0"> <tr> <td width="47%"> <div style="color: #777777;font-size: 11px;"><fl:getMessage code="LF11B" alt="Liste des valeurs de références"/></div> <div> <select multiple="multiple" id="refs2select" class="input select" size="10"> <% for(int i=0; i<listRef.size(); i++){ refName = (String) ((Hashtable) listRef.get(i)).get("RefTe1"); refID = (String) ((Hashtable) listRef.get(i)).get("RefID"); if((listSelectedRef != null && !listSelectedRef.contains(refID)) || (listSelectedRef == null)){ %> <option value="<%= refID%>"><%= refName%></option> <% }}%> </select> </div> </td> <td width="6%" align="center" valign="middle"> <table width="100%" align="center"> <tr><td align="center"><a href="javascript:addKey('refs2select','refsselected','FqtRefsDisp_', '<%=typeDisp%>')"><img src="<fl:webapp/>/icons/ico/plus.gif" id="bt_add" title="<fl:getMessage code="A000F" alt="Ajouter"/>"></a></td></tr> <tr><td align="center"><a href="javascript:deleteKey('refsselected','refs2select','FqtRefsDisp_', '<%=typeDisp%>')"><img src="<fl:webapp/>/icons/ico/moins.gif" id="bt_delete" title="<fl:getMessage code="A0007" alt="Supprimer"/>"></a></td></tr> </table> </td> <td width="47%"> <div style="color: #777777;font-size: 11px;"><fl:getMessage code="LF11C" alt="Liste des valeurs de références à afficher"/></div> <div> <select multiple="multiple" id="refsselected" class="input select" size="10"> <% if(listSelectedRef != null && listSelectedRef.size()>0){ for(int i=0; i<listSelectedRef.size(); i++){ refID = (String) listSelectedRef.get(i); refName = (String)dico.getRefDisp(locale, fqtRefTable, "Te1", refID); %> <option value="<%= refID%>"><%= refName%></option> <% }} %> </select> </div> </td> </tr> </table> </td> <td class="separation"><div class="separation"></div></td> <td class="column2"> </td> </tr> </table> </fl:sTab> </fl:smallTabs> <% } } //End if type = REF %> <% if ("LST".equals(type)){ %> <link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css"> <fl:smallTabs name="REFTabs"> <fl:sTab id="LST" title="<%= Utils.getMessage(session, \"L6137\", \"Liste Réponses Possibles\") %>"> <table class="container" cellpadding="0"> <tr> <% String fld ="FqtLstAnswer0"; for (int i=0; i<15; i++){ fld = "FqtLstAnswer"+i; %> <% if (i == 0 || i == 5 || i == 10) { %> <td class="column3"> <table class="container" cellpadding="0"> <% } %> <fl:fieldEdit property="<%= fld %>"/> <% if (i == 4 || i == 9 || i == 14) { %> </table> </td> <% if (i < 14) { %> <td class="separation"><div class="separation"></div></td><% } %> <% } %> <% } %> </tr> </table> </fl:sTab> </fl:smallTabs> <% } // End if type == LST %> </fl:bigTabs> </fl:form>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de