Edit C:\Users\Administrator\Desktop\Back\galaxie - Copy\js\infobar\infobar_js.jsp
<%@page session="true"%><%@ page language="java"%> <%@ page import="com.edeal.frontline.Utils" language="java" import="java.util.*" import="com.edeal.frontline.*,com.edeal.frontline.helper.custom.*" pageEncoding="UTF-8"%><%@ page import="com.edeal.frontline.FrontlineException" %><%@ page import="com.edeal.frontline.FlContext" %><%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@page import="com.edeal.frontline.controller.actions.ReprogramAlarmAction"%><%@page import="com.edeal.frontline.controller.actions.DeleteAlarmAction"%><%@page import="com.edeal.frontline.controller.actions.MarkInformationPanelAsReadAction"%><%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><fl:cacheControl delay="0"/><% response.setContentType("application/x-javascript"); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String idAdmin = dico.getRefIdByCode("DocRolesID", "ADMIN"); /* Recherche des roles de l'acteur */ String sessionActorID = ActorHelper.getSessionActorID(session); boolean isAdmin = ActorHelper.isAdmin(flRequest); // can create info panel ? InformationPanelBean ibp = new InformationPanelBean(session); boolean canCreateInfoPanel = false; try { canCreateInfoPanel = ibp.enforceAccess(AccessControlManager.CREATE, sessionActorID); } catch (FrontlineException fe) { } boolean canEditInfoPanel = false; try { canEditInfoPanel = ibp.enforceAccess(AccessControlManager.EDIT, sessionActorID); } catch (FrontlineException fe) { } %> /* The shape of the json string is : { "body":"Grande salle de réunion formation administrati...", "dat":"16:50", "from":"", "id":"00000000000ac979", "subject":"Formation UNIX", "type":"Alarm" } */ var defaultMessage = '<label style="color: black"><fl:getMessage code="LF384" alt="Bienvenue dans Galaxie !"/></label>'; var withScoll = "false"; <% if (canCreateInfoPanel) { %> var doCreateInformationPanelFunction = 'javascript:doCreateInformationPanel();' var link = '<a href="'+ doCreateInformationPanelFunction +'"><img src="<fl:webapp/>/icons/infobar/add.gif" alt="<fl:getMessage code="A3057" alt="Créer"/>" title="<fl:getMessage code="A3057" alt="Créer" js="true"/>" class="infobar-icon"></a>'; defaultMessage = '<table style="width: 100%"><tr class="infobar-body" style="width: 100%"><td style="width: 90%; text-align: center;">' + defaultMessage + '</td><td style="width: 10%; text-align: right;">' + link + '</td></tr></table>'; <% } %> var objectDisplayFunction = new Object(); //Construction of the information to be displayed . Objects : Alarm and InformationPanel ... objectDisplayFunction["Alarm"] = function(information) { // attributes var infoId = "'" + information.id + "'"; var infoType = "'" + information.type + "'"; var infoBody = decodeURIComponent(information.body); var infoSubject = decodeURIComponent(information.subject); var infoDate = information.dat; // functions var openPopupFunction = 'javascript:openPopup(' + infoId + ',' + infoType + ');' var doReprogramAlarmFunction = 'javascript:doReprogramAlarm(' + infoId + ');' var doDeleteAlarmFunction = 'javascript:doDeleteAlarm(' + infoId + ');' var doReadInformationPanelFunction = 'javascript:doReadInformationPanel(' + infoId + ');' // links var link_1 = '<a href="'+ doReprogramAlarmFunction +'"><img src="<fl:webapp/>/icons/infobar/valid.gif" alt="<fl:getMessage code="L709B" alt="Reprogrammer" js="true"/>" title="<fl:getMessage code="L709B" alt="Reprogrammer" js="true"/>" class="infobar-icon"></a>'; var link_2 = '<a href="'+ doDeleteAlarmFunction +'"><img src="<fl:webapp/>/icons/infobar/delete.gif" alt="<fl:getMessage code="A0007" alt="Supprimer" js="true"/>" title="<fl:getMessage code="A0007" alt="Supprimer" js="true"/>" class="infobar-icon"></a>'; // informations var informationToDisplay = '<table><tr class="infobar-title"><td><a href="'+ openPopupFunction +'">' + infoDate + ' - ' + infoSubject + '</a></td><td>' + link_1 + '</td></tr><tr class="infobar-body"><td class="infobar-body-text">' + infoBody +'</td><td>' + link_2 + '</td></tr></table>'; informationToDisplay = addCommonElement(informationToDisplay, '<img src="<fl:webapp/>/icons/infobar/alarm.gif" style="border: none; margin-right: 10px" title="<fl:getMessage code="L709E" alt="Alarme" js="true"/>" >'); //Save withScoll withScoll = information.refresh; return informationToDisplay; }; objectDisplayFunction["InformationPanel"] = function(information) { // attributes var infoId = "'" + information.id + "'"; var infoType = "'" + information.type + "'"; var infoBody = decodeURIComponent(information.body); var infoSubject = decodeURIComponent(information.subject); var infoDate = information.dat; // functions var openPopupFunction = 'javascript:openPopup(' + infoId + ',' + infoType + ');' var doReprogramAlarmFunction = 'javascript:doReprogramAlarm(' + infoId + ');' var doDeleteAlarmFunction = 'javascript:doDeleteAlarm(' + infoId + ');' var doReadInformationPanelFunction = 'javascript:doReadInformationPanel(' + infoId + ');' var doCreateInformationPanelFunction = 'javascript:doCreateInformationPanel();' // links and informations <% if (canCreateInfoPanel) { %> var link_1 = '<a href="'+ doCreateInformationPanelFunction +'"><img src="<fl:webapp/>/icons/infobar/add.gif" alt="<fl:getMessage code="A3057" alt="Créer" js="true"/>" title="<fl:getMessage code="A3057" alt="Créer" js="true"/>" class="infobar-icon"></a>'; var link_2 = '<a href="'+ doReadInformationPanelFunction +'"><img src="<fl:webapp/>/icons/infobar/valid.gif" alt="<fl:getMessage code="F7086" alt="Marquer comme lu" js="true"/>" title="<fl:getMessage code="F7086" alt="Marquer comme lu" js="true"/>" class="infobar-icon"></a>'; informationToDisplay = '<table style="width: 100%"><tr class="infobar-title"><td><a href="'+ openPopupFunction +'" style="color: black">' + infoDate + ' - ' + infoSubject + '</a></td><td>' + link_1 + '</td></tr><tr class="infobar-body"><td class="infobar-body-text" style="font-weight:normal;">' + infoBody +'</td><td>' + link_2 + '</td></tr></table>'; <% } else {%> var link = '<a href="'+ doReadInformationPanelFunction +'"><img src="<fl:webapp/>/icons/infobar/valid.gif" alt="<fl:getMessage code="F7086" alt="Marquer comme lu" js="true"/>" title="<fl:getMessage code="F7086" alt="Marquer comme lu" js="true"/>" class="infobar-icon"></a>'; informationToDisplay = '<table style="width: 100%"><tr class="infobar-title"><td><a href="'+ openPopupFunction +'" style="color: black">' + infoDate + ' - ' + infoSubject + '</a></td><td></td></tr><tr class="infobar-body"><td class="infobar-body-text" style="font-weight:normal;">' + infoBody +'</td><td>' + link + '</td></tr></table>'; <% }%> informationToDisplay = addCommonElement(informationToDisplay, '<img src="<fl:webapp/>/icons/infobar/notepad.gif" style="border: none; margin-right: 10px" title="<fl:getMessage code="L62CC" alt="Panneau d\\\'information" js="true"/>" />'); //Save withScoll withScoll = information.refresh; return informationToDisplay; }; function getInformationToDisplay(information){ return ((information.type != null) && (information.type != '')) ? objectDisplayFunction[information.type](information) : ''; } function displayInformationOnInfoBar(info){ $("#infobar_information").html(info); if (withScoll == "true"){ $("#infobar_information").slideUp("normal"); $("#infobar_information").slideDown("normal"); } } function getInfoBarInformation(forceupdate) { if ((forceupdate == null) || (typeof forceupdate == 'undefined')){ forceupdate = "false"; } else { forceupdate = "true"; } $.ajax({ url:"<fl:webapp/>/get_infobar_information.fl?forceupdate=" + forceupdate, dataType: 'json', success: analyseResponse, type: "POST", timeout: 20000 }); function analyseResponse(information) { if ((information != null) && (information.type != null) && (information.type != '')) { var informationToDisplay = getInformationToDisplay(information); if (informationToDisplay == '') displayInformationOnInfoBar(addCommonElement(defaultMessage)); else displayInformationOnInfoBar(getInformationToDisplay(information)); } else { displayInformationOnInfoBar(addCommonElement(defaultMessage)); } } } function addCommonElement(info, imag){ if (imag == null) imag = '<img src="<fl:webapp/>/icons/infobar/notepad.gif" style="border: none; margin-right: 10px"/>'; contentHTML = '<table><tr><td style="vertical-align: middle; text-align: left;">'+ imag + '</td><td style="height: 30px; text-align: center">' + info + '</td></tr></table>'; return contentHTML; } $.setupJMPopups({ screenLockerBackground: "#222222", screenLockerOpacity: "0.3" }); function openPopup(id, type) { if ((id == null) || (type == null)) return; if (type == "Alarm") { namePopup = "alarmPopup"; urlPopup = "<fl:webapp/>/open_popup_alarm.fl?id=" + id; openAjaxPopup(namePopup, urlPopup); } else if (type == "InformationPanel") { <% if (canEditInfoPanel) { %> //modification namePopup = "informationpanelPopup"; urlPopup = "<fl:webapp/>/open_popup_informationpanel.fl?id=" + id; openJSPopup(namePopup, urlPopup); <% } else { %> //consultation namePopup = "informationpanelPopup"; urlPopup = "<fl:webapp/>/open_popup_informationpanel_ajax.fl?id=" + id; openAjaxPopup(namePopup, urlPopup); <% } %> } } function openAjaxPopup(namePopup, urlPopup){ jQuery.openPopupLayer({ name: namePopup, width: 800, height: 250, url: urlPopup, cache: true, success: function (data) { }, error: function () { alert("Erreur lors de l'ouverture de la popup !"); } }); } function openJSPopup(namePopup, urlPopup){ var win = window.open(urlPopup, namePopup, 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=850,height=650'); } function doDeleteAlarm(id) { urlAjax("<fl:webapp/>/delete_alarm_shortcut.fl?id=" + id); } function doReprogramAlarm(id, newdate) { url = "<fl:webapp/>/reprogram_alarm_shortcut.fl?id=" + id if (newdate != null) url = url + "&newdate=" + newdate; urlAjax(url); } function doReadInformationPanel(id) { urlAjax("<fl:webapp/>/mark_read_informationpanel.fl?id=" + id); } function doCreateInformationPanel() { namePopup = "informationpanelPopup"; urlPopup = "<fl:webapp/>/open_popup_informationpanel.fl"; openJSPopup(namePopup, urlPopup); } function urlAjax(url){ $.ajax({ url: url, dataType:'text', async: false, success: analyseResponse }); function analyseResponse(response) { if (response != null){ switch(response) { case '<%= DeleteAlarmAction.ALARM_OK_DELETE %>': //displayMessage('<fl:getMessage code="L709F" alt="L\\\'alarme a été bien supprimée" js="true"/>'); break; case '<%= DeleteAlarmAction.ALARM_NO_DELETE %>': displayMessage('<fl:getMessage code="L70A1" alt="Erreur lors de la suppression de l\\\'alarme" js="true"/>'); break; case '<%= ReprogramAlarmAction.ALARM_OK_REPROGRAM %>': //displayMessage('<fl:getMessage code="L70A0" alt="L\\\'alarme a été reprogrammée" js="true"/>'); break; case '<%= ReprogramAlarmAction.ALARM_NO_REPROGRAM %>': displayMessage('<fl:getMessage code="L70A4" alt="Erreur lors de la reprogrammation de l\\\'alarme" js="true"/>'); break; case '<%= MarkInformationPanelAsReadAction.INFORMATIONPANEL_OK_READ %>': //displayMessage('<fl:getMessage code="M900D" alt="Le panneau d\\\'information a été marqué comme lu" js="true"/>'); break; case '<%= MarkInformationPanelAsReadAction.INFORMATIONPANEL_NO_READ %>': displayMessage('<fl:getMessage code="M900C" alt="Erreur lors de la mise en lecture du panneau d\\\'information" js="true"/>'); break; default: break; } } } //forcer la mise à jour des infos getInfoBarInformation("force_update"); } function displayMessage(message) { window.alert(message); }
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de