Edit C:\galaxie\Back\galaxie\common\list\custom\listAjaxCustomContrat_.jsp
<%@ page language="java" contentType="text/plain;charset=UTF-8"%> <% /****************************************************************************** * Copyright (c) 2000-2011 E-DEAL * * E-DEAL S.A. * 41, rue Périer * 92120 Montrouge * France * * T: +33 (0)1 73 03 29 80 * 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. ******************************************************************************/ // Please note! If you change this file in any way, please make the same changes to any // JSP file containing the following string: //**listAjax.jsp**// %><%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.grid.*" %> <%@ page import="com.edeal.frontline.*" %> <%@ page import="com.edeal.frontline.grid.EdealGrid" %> <%@ page import="java.util.*" %> <%@ page import="com.edeal.frontline.FrontlineException" %> <%@ page import="com.edeal.frontline.navigation.EdealBigTabsNavigation" %> <%@ page import="com.edeal.frontline.navigation.EdealBigTabsNavigation.BigTabsParams" %> <%@page import="java.util.Enumeration"%> <%@page import="com.edeal.frontline.helper.ActorBaseHelper"%> <%@page import="com.edeal.frontline.helper.custom.ActorHelper"%> <%@page import="org.apache.commons.lang.StringUtils"%> <%@page import="com.edeal.frontline.helper.custom.ListHelper"%> <%@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); String code = flRequest.getRequestParameterOrAttribute("gridName"); if (code == null) { String paramCode = flRequest.getRequestParameterOrAttribute("code"); String gn=((paramCode==null?"":paramCode) + "_gridname"); code = flRequest.getRequestParameterOrAttribute(gn); if (code == null) { code = paramCode; } } GridData grid = (GridData)flRequest.getAttribute(code); boolean isEmbedded = flRequest.getAttribute(code + "_Embedded") != null; boolean isEmbedded2 = grid.isEmbedded(); String type = (String)flRequest.getAttribute("objSql"); if (type==null) { type=(String)flRequest.getAttribute(code+"_objSql"); } boolean fIsListEmbedded=isEmbedded || isEmbedded2; FlContext context = flRequest.getContext(); EdealBigTabsNavigation bTabNav = new EdealBigTabsNavigation(flRequest); bTabNav.setBigTabsParameterValue(BigTabsParams.SelectedTab, "1"); DataDictionary dico = context.getDataDictionary(); String pEditMode=flRequest.getParameter("editmode"); boolean fUpdateMode=("true".equals(pEditMode)); String pAllowUserUpdate=flRequest.getParameter("allowupdate"); boolean fAllowUpdate=("true".equals(pAllowUserUpdate)); // is preview to be displayed ? String pDisplayPreview=flRequest.getSearchCriteria("$$preview"); boolean fDisplayPreview=("true".equals(pDisplayPreview)); String pGridHeight=flRequest.getParameter("gridheight"); EdealGrid edealGrid=new EdealGrid(); edealGrid.setName(code); edealGrid.buildColumns(session, context, grid); //boolean fAllowUpdate=true; //boolean fUpdateMode=false; int totalNbOfRecs=grid.getTotalNbOfRecords(); boolean fDisplayCounter=(totalNbOfRecs!=0); int pageNumber=grid.getPageNumber()+1; fAllowUpdate=fAllowUpdate && grid.isUpdatable(); if (fAllowUpdate) { ActorBaseHelper actorHlpr=ActorBaseHelper.factory(ActorBaseHelper.getSessionActor(session)); fAllowUpdate=fAllowUpdate && actorHlpr.canUseObjectForOperation(type,AccessControlManager.EDIT); } String jsGridObject=bTabNav.getBigTabsParameterValue(BigTabsParams.NameSearchGridJs); String[] updColumnFields=grid.getColumnUpdFld(); boolean canUpdateList=((updColumnFields!=null) && (updColumnFields.length>0)); // can we mass select entries ? boolean isMassSelect=grid.isMassSelectable(); String previewToken=grid.getPreviewCacheToken(); ListPreviewCache.PreviewCache previewCache=null; if (previewToken!=null) { previewCache=ListPreviewCache.factory(flRequest.getSession()).getCache(previewToken); } if(grid.getNbRows()==0){ %> <fl:label code="L0001" label="Aucune entrée disponible "/> <%}else{ int totalNbOfPages=1; try { if(totalNbOfRecs > grid.getNbLines()){ if(totalNbOfRecs % grid.getNbLines()>0){ totalNbOfPages=(totalNbOfRecs/grid.getNbLines())+1; } else{ totalNbOfPages=(totalNbOfRecs/grid.getNbLines()); } } } catch (ArithmeticException e) {//avoid / by } %> <div id="grid-actions"> <table width="100%"> <tr> <td width="33%"></td> <td width="33%" style="text-align:center;"> <% if(!(grid.isFirstPage() && grid.isLastPage())){%> <span class="grid-action"> <%if(!grid.isFirstPage()){%> <a onclick="<%=jsGridObject%>.loadPage('0',$('input.btMassEdit:checked').length>0);return false;" href="#"> <img src="<fl:webapp/>/icons/ico/flecheGdouble.gif"/> </a> <a onclick="<%=jsGridObject%>.loadPage('<%=grid.getPageNumber()-1%>',$('input.btMassEdit:checked').length>0);return false;" href="#"> <img src="<fl:webapp/>/icons/ico/flecheG.gif"/> </a> <%} if (fDisplayCounter) {%> <%=Utils.getMessage(session, "F608C", "Page")%> <%=pageNumber+"/"+totalNbOfPages%><%= " - ("+totalNbOfRecs+")"%> <%} else { %> <%=Utils.getMessage(session, "F608C", "Page")%> <%=pageNumber %> <% } %> <%if(!grid.isLastPage()){ %> <a onclick="<%=jsGridObject%>.loadPage('<%=grid.getPageNumber()+1%>',$('input.btMassEdit:checked').length>0);return false;" href="#"> <img src="<fl:webapp/>/icons/ico/flecheD.gif"/> </a> <% if (totalNbOfPages>1) { %> <a onclick="<%=jsGridObject%>.loadPage('<%=totalNbOfPages-1%>',$('input.btMassEdit:checked').length>0);return false;" href="#"> <img src="<fl:webapp/>/icons/ico/flecheDdouble.gif"/> </a> <%}%> <%}%> </span> <%}%> </td> <td width="33%" style="text-align:right;"> <% if (fAllowUpdate && !fUpdateMode) { %> <span class="grid-action"> <a class="action-item" onclick="javascript:<%= jsGridObject+".reloadForEdition()"%>;return false;" href="#"><fl:getMessage code="FF1BD" alt="Saisir la date de Retour"/></a> </span> <% } %> <% if (fUpdateMode) { %> <span class="grid-action"> <a id="grid-save-button" class="action-item" onclick="javascript:<%=jsGridObject+".save()"%>;return false;" href="#"><fl:getMessage code="A0003" alt="Enregistrer"/></a> <a class="action-item" onclick="javascript:<%= jsGridObject+".reset()"%>;return false;" href="#"><fl:getMessage code="A2002" alt="Annuler"/></a> </span> <% } %> </td> </tr> </table> </div> <div id="grid-data" class="data"<%= (previewToken==null)?"":" ed:previewtoken=\""+previewToken+"\"" %> ed:embedded="<%= fIsListEmbedded %>" style="<%= (pGridHeight!=null)?"height:"+pGridHeight:""%>"> <table cellpadding="0"> <thead> <tr> <% if (isMassSelect && !fIsListEmbedded) { %> <th><input type="checkbox" onclick="<%=jsGridObject%>.addMassSelectAll(this.checked)"></th> <% } %> <% int formIndex=1; for (EdealGridColumn gridColumn: edealGrid.getColumns()) { if (gridColumn.getDataType() != null && !gridColumn.getDataType().equals(EdealGridColumn.DataType.PREVIEW)) { %> <%=gridColumn.getHeader(edealGrid.getJsGridName(),edealGrid.getName(),flRequest)%> <%} } %></tr> </thead> <tbody><% ArrayList<String> rowsId = grid.getRowsId(); //ArrayList<String> previewValue = new ArrayList(); boolean oddRow = false; ActorBean currentActor=ActorHelper.getSessionActor(session); BasicBean rowBean; int nbOfRows=grid.getData().length; int tabindex=20; int nbOfCols=0; Object[][] gridRows=grid.getData(); for(int rowidx = 0; rowidx < nbOfRows; rowidx++) { String id = ""; oddRow = !oddRow ; String objectID=""; if (rowsId != null && rowsId.size()>0 && rowsId.get(rowidx) != null) { objectID=rowsId.get(rowidx); } Boolean withPreview = false; String previewTxt = ""; if (fDisplayPreview) { previewTxt = (previewCache == null) ? null : previewCache.getPreviewForID(objectID); if (!StringUtils.isEmpty(previewTxt)) { withPreview = true; } } %> <tr id="<%= objectID %>" class="<%= (oddRow ? "even" : "odd") %> bean" tabindex="<%=++tabindex%>"> <% if (isMassSelect && !fIsListEmbedded) { %> <td><input id="massselectcheck-<%=objectID%>" type="checkbox" onclick="<%=jsGridObject%>.addMassSelect('<%=objectID%>',this.checked)"></td> <% } Object[] row = gridRows[rowidx]; boolean allowedToEdit =false; if (fUpdateMode && canUpdateList) { try { rowBean= dico.getTable("sql",type).getBasicBean(objectID,session); allowedToEdit=rowBean.enforceAccess(AccessControlManager.EDIT,currentActor); if (allowedToEdit) { request.setAttribute(type,rowBean); } } catch (FrontlineException e) { logger.error("listAjax.jsp: cannot load bean ["+type+"]["+objectID+"]",e); } } nbOfCols=row.length; for (int colidx = 0; colidx < row.length; colidx++) { EdealGridColumn eGCol = edealGrid.getColumn(colidx); if (allowedToEdit && updColumnFields[colidx]!=null) { String fieldsToBeUpdated=updColumnFields[colidx]; Vector<String> vFieldsToBeUpdated=(Vector<String>)Utils.explodeList(fieldsToBeUpdated,";"); Enumeration<String> enumFieldsToBeUpdated=vFieldsToBeUpdated.elements(); %> <td><div><table class="data_column" cellpadding="0"><tr class="fieldline"> <% while (enumFieldsToBeUpdated.hasMoreElements()) { String fieldName=enumFieldsToBeUpdated.nextElement(); String eraseJs="eraseField('"+fieldName+"-"+objectID+"')"; %> <td class="listDataValue"> <div class="input text"> <fl:input property="<%=fieldName%>" id="<%=fieldName+\"-\"+objectID%>" ondelete="<%=eraseJs%>" nodiv="true" alt=" "/> </div> </td> <% formIndex++; } %> </tr></table></div></td> <% } else { %> <%= eGCol.advancedFormatWithTD(row[colidx], withPreview) %> <% } } %></tr> <% if (withPreview) { %> <tr id="<%= objectID %>_preview" class="<%= (oddRow ? "even" : "odd") %> list_preview" tabindex="<%=++tabindex%>"> <%= ListHelper.previewFormatWithTD(nbOfCols, previewTxt, row[0]) %> </tr> <% } } if (type!=null && request.getAttribute(type)!=null) { request.removeAttribute(type); } %> </tbody> </table> </div> <% } %>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de