Edit C:\Users\Administrator\Desktop\Back\galaxie - Copy\marketing\linkscriptelement\linkScriptElement_list_ajax.jsp
<% /****************************************************************************** * Copyright (c) 2000-2006 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" contentType="text/plain;charset=UTF-8"%> <%@ page import="com.edeal.frontline.*" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="java.util.Vector" %> <%@ page import="java.util.Hashtable" %> <%@ page import="java.text.DecimalFormat" %> <%@ page import="com.edeal.frontline.FlLocale" %> <%@ page import="com.edeal.frontline.Utils" %> <% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); boolean isOracle = "Oracle".equalsIgnoreCase(context.getContextParameter("DatabaseVendor")); Vector pages = (Vector)flRequest.getAttribute("pages"); String id = (String)flRequest.getAttribute("id"); StringBuffer tableBuf = new StringBuffer(); tableBuf.append("<table class=\\\"container\\\" cellpadding=\\\"0\\\">"); boolean isBlue = true; if (id != null) { boolean pageMode = false; if (pages != null && pages.size() > 0) { pageMode = true; } if (pageMode) { String[] lseFields = {"LseID" , "LseScriptElementID" , "LseScriptElementID:SceLabel", "LsePosition", "LsePageID", "LsePageID:ScpCode", "LsePageID:ScpTitre", "LsePageID:ScpPosition"}; String[][] lseQuery = {{"LseScriptID = " + Utils.formatToSQL(context, id)}}; String[] lseOrderBy = {"LsePageID:ScpPosition", "LsePosition"}; Vector elements = LinkScriptElementBean.listSummary(session, lseFields, lseQuery, lseOrderBy); String oldPageID = ""; Vector usedPages = new Vector(); tableBuf.append("<tr valign=\\\"top\\\">"); tableBuf.append("<td class=\\\"fieldline\\\">"); tableBuf.append("<table class=\\\"container\\\">"); for (int i = 0; i < elements.size(); i++) { Hashtable row = (Hashtable)elements.elementAt(i); String lseID = (String)row.get("LseID"); String elementID = (String)row.get("LseScriptElementID"); String elementLabel = (String)row.get("LseScriptElementID:SceLabel"); Number lsePosition = (Number)row.get("LsePosition"); String pageID = (String)row.get("LsePageID"); String pageTitle = (String)row.get("LsePageID:ScpTitre"); String pageCode = (String)row.get("LsePageID:ScpCode"); // detection de la coupure boolean coupure = false; if (i == 0) { coupure = true; } else if ("".equals(oldPageID)) { coupure = pageID != null; } else if (pageID == null) { coupure = !"".equals(oldPageID); } else { coupure = !oldPageID.equals(pageID); } if (coupure) { if (pageID == null) { tableBuf.append("<tr class=\\\"fieldLine\\\">"); tableBuf.append("<td colspan=\\\"5\\\" width=\\\"100%\\\"><span class=\\\"alertbandeau\\\">"+Utils.getMessage(session, "L6310", true, "Attention : Tous les éléments doivent être rattachés à une page.")+"</span></td>"); tableBuf.append("</tr>"); tableBuf.append("<tr class=\\\"fieldLine\\\">"); tableBuf.append("<td class=\\\"dataLabel\\\" width=\\\"100%\\\" colspan=\\\"5\\\">"); tableBuf.append(Utils.getMessage(session, "L6418", true, "Eléments non attachés")); tableBuf.append("</td>"); tableBuf.append("</tr>"); } else { usedPages.addElement(pageID); tableBuf.append("<tr class=\\\"ligne_separation\\\"><td></td></tr>"); tableBuf.append("<tr class=\\\"fieldLine\\\">"); tableBuf.append("<td style=\\\"background : #FFFFFF\\\" class=\\\"dataValueX borderLineOne\\\" width=\\\"10%\\\" style=\\\"text-align : center\\\">"); tableBuf.append("<a href=\"javascript:viewPage(\\\'"+ Utils.formatToJavascript(pageID) + "\\\');\"><img src=\""+ context.getContextName() +"/icons/ico/zoom.gif\\\" border=\\\"0\\\" height=\\\"15\\\" width=\\\"15\\\" alt=\\\"\\\"></a>"); tableBuf.append("</td>"); tableBuf.append("<td colspan=\\\"2\\\" style=" + (isBlue ? "background : #EBF4F6" : "background : #FFFFFF" ) + " class=\\\"dataValueX borderLineOne\\\" width=\\\"80%\\\" >"); tableBuf.append(Utils.formatToWeb(pageCode, false)+( pageCode != null && pageTitle != null ? " - " : "" ) + ( Utils.formatToWeb(pageTitle, false) )); tableBuf.append("</td>"); tableBuf.append("</tr>"); tableBuf.append("<tr class=\\\"ligne_separation_couleur\\\" style=\\\"height: 1px;\\\"><td style=\\\"padding: 0px;\\\" colspan=\\\"5\\\"></td></tr>"); } oldPageID = pageID != null ? pageID : ""; } // get all LinkScriptElements attached to this page tableBuf.append("<tr class=\\\"fieldLine\\\">"); tableBuf.append("<td style=\\\"background : #FFFFFF\\\" class=\\\"dataValueX borderLineOne\\\" width=\\\"10%\\\" style=\\\"text-align : right\\\">"); //<!-- A mettre en popup --> tableBuf.append("<a href=\\\"javascript:viewLinkScriptElement(\\\'" + Utils.formatToJavascript(lseID) + "\\\');\\\"><img src=\\\""+ context.getContextName() +"/icons/ico/zoom.gif\\\" border=\\\"0\\\" height=\\\"15\\\" width=\\\"15\\\" alt=\\\"\\\"></a>"); tableBuf.append("</td>"); tableBuf.append("<td style=" + (isBlue ? "background : #EBF4F6" : "background : #FFFFFF" ) + " class=\\\"dataValueX borderLineOne\\\" width=\\\"10%\\\" >"+ lsePosition + "</td>"); tableBuf.append("<td style=" + (isBlue? "background : #EBF4F6" : "background : #FFFFFF" ) + " class=\\\"dataValueX borderLineOne\\\" width=\\\"80%\\\" ><a href=" + flRequest.computeURL("/read_scriptelement.fl?id="+elementID, true, true, true) + ">" + Utils.formatToJavascript(Utils.formatToWeb(elementLabel, false)) + "</a></td>"); tableBuf.append("</tr>"); }//End for each elements boolean messageShown = false; for (int i = 0; i < pages.size(); i++) { Hashtable row = (Hashtable)pages.elementAt(i); String pageID = (String)row.get("ScpID"); String pageTitle = (String)row.get("ScpTitre"); String pageCode = (String)row.get("ScpCode"); if (!usedPages.contains(pageID)) { if (!messageShown) { messageShown = true; tableBuf.append("<tr class=\\\"ligne_separation\\\"><td></td></tr>"); tableBuf.append("<tr class=\\\"ligne_separation\\\"><td></td></tr>"); tableBuf.append("<tr valign=\\\"top\\\">"); tableBuf.append("<td colspan=\\\"5\\\" width=\\\"100%\\\"><span class=\\\"alertbandeau\\\">"+Utils.getMessage(session, "L6311", true, "Les pages ci-dessous ne seront pas affichées car elles ne contiennent aucun élément de script.")+"</span></td>"); tableBuf.append("</tr>"); } tableBuf.append("<tr class=\\\"fieldLine\\\">"); tableBuf.append("<td width=\\\"1%\\\" nowrap ><img src=\\\""+ context.getContextName() +"/icons/spacer.gif\\\" border=\\\"0\\\" height=\\\"15\\\" width=\\\"15\\\" alt=\\\"\\\"></td>"); tableBuf.append("<td style=\\\"background : #FFFFFF ; text-align : right\\\" class=\\\"dataValueX borderLineOne\\\" width=\\\"10%\\\" >"); tableBuf.append("<a href=\\\"javascript:viewPage(\\\'"+ Utils.formatToJavascript(pageID) +"\\\')\\\"><img src=\\\""+ context.getContextName() +"/icons/ico/zoom.gif\\\" border=\\\"0\\\" height=\\\"15\\\" width=\\\"15\\\" alt=\\\"\\\"></a>"); tableBuf.append("</td>"); tableBuf.append("<td colspan=\\\"2\\\" style=\\\"" + (isBlue? "background : #EBF4F6" : "background : #FFFFFF" ) + "; text-align : left\\\" class=\\\"dataValueX borderLineOne\\\" width=\\\"90%\\\" >"); tableBuf.append(Utils.formatToJavascript(Utils.formatToWeb(pageCode, false)) + (pageCode != null && pageTitle != null ? " - " : "" )+ Utils.formatToJavascript(Utils.formatToWeb(pageTitle, false))); tableBuf.append("</td></tr>"); tableBuf.append("<tr class=\\\"ligne_separation_couleur\\\" style=\\\"height: 1px;\\\"><td style=\\\"padding: 0px;\\\" colspan=\\\"5\\\"></td></tr>"); } isBlue = !isBlue; } tableBuf.append("</table></td></tr>"); } else { //get all script elements linked to this script, and for each one, count the number of transitions String query; if (isOracle) { query = "SELECT LseID, LseScriptElementID, SceLabel, LsePosition, COUNT(SetID)\n" + "FROM LinkScriptElement, ScriptElement, ScriptElementTransition\n" + "WHERE LseScriptElementID = SceID (+)\n" + "AND LseID = SetLse1ID (+)\n" + "AND LseScriptID = " + Utils.formatToSQL(context, id) + "\n" + "GROUP BY LseID, LseScriptElementID, SceLabel, LsePosition\n" + "ORDER BY LsePosition\n"; } else { query = "SELECT LseID, LseScriptElementID, SceLabel, LsePosition, COUNT(SetID)\n" + "FROM LinkScriptElement\n" + "LEFT OUTER JOIN ScriptElement ON SceID = LseScriptElementID\n" + "LEFT OUTER JOIN ScriptElementTransition ON SetLse1ID = LseID\n" + "WHERE LseScriptID = " + Utils.formatToSQL(context, id) + "\n" + "GROUP BY LseID, LseScriptElementID, SceLabel, LsePosition\n" + "ORDER BY LsePosition\n"; } String[] fields = {"LseID" , "LseScriptElementID" , "LseScriptElementID:SceLabel", "LsePosition", "CountTransitions"}; Vector linksList = LinkScriptElementBean.listSQL(session, fields, query); if (linksList != null && linksList.size() > 0) { tableBuf.append("<tr class=\\\"fieldLine\\\"><td colspan=\\\"4\\\">"); tableBuf.append("<table class=\\\"container\\\">"); tableBuf.append("<tr class=\\\"fieldLine\\\">"); tableBuf.append("<td class=\\\"headerDataGrid \\\" style=\\\"width: 10%;\\\">"+Utils.getMessage(session, "L6417", true, "Pos.")+"</td>"); tableBuf.append("<td class=\\\"headerDataGrid \\\" style=\\\"width: 10%;\\\">"+Utils.getMessage(session, "F6089", true, "Nb. transitions")+"</td>"); tableBuf.append("<td class=\\\"headerDataGrid \\\" style=\\\"width: 80%;\\\">"+Utils.getMessage(session, "L61EF", true, "Elément de script")+"</td>"); tableBuf.append("</tr>"); //for each link found, display a row for (int i=0 ; i < linksList.size() ; i++) { Hashtable curLink = (Hashtable) linksList.elementAt(i); String curLseScriptElementID = (String) curLink.get("LseScriptElementID"); String sceLabel = (String) curLink.get("LseScriptElementID:SceLabel"); int lsePosition = ((Number) curLink.get("LsePosition")).intValue(); String lseID = (String)curLink.get("LseID"); int count = ((Number)curLink.get("CountTransitions")).intValue(); tableBuf.append("<tr class=\\\""+ (isBlue? "tabSimpleFdBleu" : "tabSimpleFdBlanc" )+"\\\"><td style=\\\"text-align : right\\\" class=\\\"dataValueX borderLineOne\\\" width=\\\"10%\\\" >" + lsePosition +"</td>"); tableBuf.append("<td style=\\\"text-align : right\\\" class=\\\"dataValueX borderLineOne\\\" width=\\\"10%\\\" ><a href=\\\""+ "javascript:viewLinkScriptElement(\\\'"+ lseID +"\\\');\\\">"+ count +"</a></td>"); tableBuf.append("<td style=\\\"text-align : left\\\" class=\\\"dataValueX borderLineOne\\\" width=\\\"80%\\\" ><a href=\\\"" + flRequest.computeURL("/read_scriptelement.fl?id="+ curLseScriptElementID , true, true, true)+ "\\\">"+ Utils.formatToJavascript(Utils.formatToWeb(sceLabel, false)) +"</a></td></tr>"); isBlue = !isBlue; } tableBuf.append("</table></td></tr>"); } else { tableBuf.append("<tr class=\\\"fieldline\\\">"); tableBuf.append("<td class=\\\"dataValue\\\">"); tableBuf.append(Utils.getMessage(session, "L61FF", true, "Aucun élément de script n'est rattaché à ce script.")); tableBuf.append("</td></tr>"); } } } tableBuf.append("</table>"); %>var f = document.getElementById('ELTSCRIPT1'); f.innerHTML = '<%= tableBuf.toString() %>';
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de