Edit C:\galaxie\Back\galaxie\js\edeal\tools\utils.js
Utils = { getParameterByName: function(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) { return ""; } else { return decodeURIComponent(results[1].replace(/\+/g, " ")); } }, completeWithDefaultValues: function(objToComplete, objDefault) { //$.extend(true, objToComplete, objDefault); var tempDefault = {}; $.extend(true, tempDefault, objDefault); $.extend(true, tempDefault, objToComplete); return tempDefault; }, loadGoogleAPIsLoader: function() { if (!edApplication().googleAPIsLoaderLoaded && !edApplication().googleAPIsLoaderLoading) { edApplication().googleAPIsLoaderLoading = true; var script = document.createElement("script"); if (edApplication().geocoderkey) { script.src = "http://www.google.com/jsapi?key=" + edApplication().geocoderkey + "&callback=Utils.googleAPIsLoaderLoaded"; } else { script.src = "http://www.google.com/jsapi?callback=Utils.googleAPIsLoaderLoaded"; } script.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); } }, googleAPIsLoaderLoaded: function() { edApplication().googleAPIsLoaderLoaded = true; edApplication().googleAPIsLoaderLoading = false; $(document).trigger("googleAPIsLoader_loaded"); }, loadGoogleMapAPI: function() { if (!edApplication().googleAPIsLoaderLoaded) { $(document).one("googleAPIsLoader_loaded", Utils.loadGoogleMapAPI); Utils.loadGoogleAPIsLoader(); } else { if (!edApplication().googleMapsAPIInvalidKey) { edApplication().googleMapsAPIInvalidKey = false; } if (!edApplication().googleMapsAPILoaded && !edApplication().googleMapsAPILoading && !edApplication().googleMapsAPIInvalidKey) { //console.log("launch google maps api loading"); edApplication().googleMapsAPILoading = true; google.load("maps", "3", {"other_params": "sensor=false", "callback" : Utils.googleMapsAPILoaded}); } } }, googleMapsAPILoaded: function() { edApplication().googleMapsAPILoading = false; edApplication().googleMapsAPILoaded = true; //test a geoloc to check if the key is correct try { edApplication().geocoder = new google.maps.Geocoder(); //try to call a map var testel = $("<div id='testel' style='width:1px; height:1px'></div>"); $("body").append(testel); var testMap = new google.maps.Map(document.getElementById("testel")); testel.remove(); edApplication().googleMapsAPIInvalidKey = false; } catch(e) { edApplication().googleMapsAPIInvalidKey = true; return; } $(document).trigger("googleMapsAPI_loaded"); }, openDialog: function(title, content, options, id) { var dialogView; if (id && (typeof(edManager) != "undefined")) { dialogView = edManager.getViewByID(id); if (dialogView) { //Notification allready exists, just put it to screen center dialogView.open(); dialogView.$el.dialog("moveToTop"); } } if (!dialogView) { if (!content.url) { dialogView = Utils.createDialogView(title, content, options, id); dialogView.render(); dialogView.open(); } else { if (!options) { options = {}; } options.async = {}; options.async.url = content.url; options.async.parameters = options.parameters; options.async.datatype = "html"; dialogView = Utils.createDialogView(title, content, options, id); dialogView.on("onrender", function() {this.open();}); } } return dialogView; }, createDialogView: function(title, content, options, id) { var randomId = id; if (!randomId) { var randomId = this.id + "_" + Math.floor(Math.random()*5001); } var attr = {}; attr.id = randomId; attr.title = title; attr.content = content; for (var attrname in options) { attr[attrname] = options[attrname]; } var aModel = new Models.Value({id: randomId, title: title, content: content}); aModel.set("value", content); attr.model = aModel; attr.parentel = $("body"); var dialogView = new Views.Dialog(attr); edManager.registerView(dialogView); return dialogView; }, //this method take a name, //identify if the input correspond to a view //if it's a multivalued view, create an input containing values formatted for the java bean and rename the input's view in the form normalizeInputFromViewForSave: function(name, aForm, separator) { //try to get the view var view = edManager.getViewByID(name); if (!view) { return false; } var realView; if (view.options.isinlist && !view.options.isaddview) { realView = view.options.parentview; } else { realView = view; } if (!aForm) { aForm = document.forms[0]; } if (!separator) { var separator = "|"; if (aForm.$$multivalSeparator) { separator = aForm.$$multivalSeparator.value; } } //remove addview from form if (view.options.isaddview) { aForm.name = null; return false; } if (!realView) { return false; } if (realView.id.indexOf(edManager.options.INPUT_SUFFIX) > -1) { return false; } aForm.name = null; if (!aForm[realView.id]) { var newInput = document.createElement("input"); newInput.id = realView.id; newInput.name = realView.id; newInput.type = "hidden"; var val = ""; realView.model.each(function(modelItem) { if (val != "") { val = val + separator; } val = val + modelItem.get("value"); }); newInput.value = val; document.forms[0].appendChild(newInput); } }, //this method take a name, //identify if the input correspond to a view //if it's a multivalued view, return a string containing values separated by separator getNormalizedValuesFromView: function(name, aForm, separator) { //try to get the view var view = edManager.getViewByID(name); if (!view) { return ""; } if (!aForm) { aForm = document.forms[0]; } if (!separator) { var separator = "|"; if (aForm) { if (aForm.$$multivalSeparator) { separator = aForm.$$multivalSeparator.value; } } } var val = ""; view.model.each(function(modelItem) { if (val != "") { val = val + separator; } val = val + modelItem.get("value"); }); return val; }, getParentViewFromDomEl: function(el) { var tempel = el; while ((tempel.attr("ed") != "true") && (tempel.get(0).tagName != "body")) { tempel = tempel.parent(); } if (tempel.get(0).tagName != "body") { return edManager.getViewByID(tempel.attr("id")); } else { return undefined; } }, formatStringForModel: function(str) { return str.replace(/\\'/g, "'"); }, formatStringForEDTag: function(str) { return str.replace(/\'/g, "'"); }, normalizeUrl: function(url) { var normalizedUrl = url; if (url.toLowerCase().substring(0,7) != "http://" && url.toLowerCase().substring(0,3) != "www") { normalizedUrl = edApplication().path + url; } return normalizedUrl; } }; var geo; //computeLatitudeAndLongitude(address) function computeLatitudeAndLongitude(oGeoLocalizeBean) { if (oGeoLocalizeBean.updatePositionAction != "" || oGeoLocalizeBean.isPositionComputed == 0) { if (!geo) geo = new GClientGeocoder(); geo.getLocations(oGeoLocalizeBean.gMapFormattedAddress, function (result){ //If that was successful if (result.Status.code == G_GEO_SUCCESS) { // Lets assume that the first marker is the one we want var p = result.Placemark[0].Point.coordinates; var lat=p[1]; var lng=p[0]; var url = "./" + oGeoLocalizeBean.updatePositionAction + ".fl"; if (oGeoLocalizeBean.type=="Enterprise") { var data = { id: oGeoLocalizeBean.id, EntLa: parseFloat(lat), EntLo: parseFloat(lng), status:G_GEO_SUCCESS }; } else { if (oGeoLocalizeBean.type=="Person") { var data = { id: oGeoLocalizeBean.id, PerLa: parseFloat(lat), PerLo: parseFloat(lng), status:G_GEO_SUCCESS }; } } if (data) { $.ajax({ url: url , data: data, dataType:"json", context: this, //timeout: 5000, success: function(data, textStatus, jqXHR) { }, error: function(jqXHR, textStatus, errorThrown) { console.log("error :"); console.log("jqXHR :"); console.log(jqXHR); console.log("textStatus :"); console.log(textStatus); console.log("errorThrown :"); console.log(errorThrown); } }); } } }); } } //generate the tooltips //must be dynamically generated the day we will use the Views:Link //DO NOT delete this method ! // loadToolTip must replace getToolTip method in global_js.jsp // it's a retrocompatibility function. // it's a better practice to use an EdLink tag in order to do that function loadToolTip(el) { if (el.attr("edToolTip") == "true" && ((el.attr("edToolTipId") && el.attr("edToolTipType")) || el.attr("edToolTipContent")) && !el.attr("edToolTipLoaded") && !el.attr("edToolTipEmpty")) { var edtooltip = normalizeTooltipOptions(el); if (edtooltip) { el.qtip({ content: edtooltip.content, show: edtooltip.show, hide: edtooltip.hide, position: edtooltip.position, style: { classes: 'qtip-light qtip-shadow qtip-rounded', //width: 250, tip: { width: 4, height: 4 } } }); el.trigger("mouseenter"); } } } function normalizeTooltipOptions(el) { var edtooltip = {}; var content; if (el.attr("edToolTipContent")) { content = el.attr("edToolTipContent"); edtooltip = {}; edtooltip.content = {}; edtooltip.content.text = content; } edtooltip.show = {}; edtooltip.show.delay = 1000; edtooltip.show.event = 'mouseenter'; edtooltip.show.solo = true; edtooltip.hide = {}; edtooltip.hide.delay = 400; edtooltip.hide.event = 'mouseleave'; edtooltip.hide.leave = true; edtooltip.hide.fixed = true; edtooltip.position = {}; edtooltip.position.my = "bottom left"; edtooltip.position.at = "top right"; edtooltip.position.target= el; edtooltip.position.viewport= $(window); if (!edtooltip.content) { edtooltip.content = {}; } if (el.attr("edToolTipId") && el.attr("edToolTipType")) { //Uppercase the first character of objtype edtooltip.objtype = el.attr("edToolTipType").substring(0,1).toUpperCase() + el.attr("edToolTipType").substring(1,el.attr("edToolTipType").length); edtooltip.objid = el.attr("edToolTipId"); edtooltip.content = {}; edtooltip.content.text = 'Loading'; edtooltip.content.ajax = {}; edtooltip.content.ajax.url = 'load_tooltip.fl'; edtooltip.content.ajax.loading = false; edtooltip.content.ajax.once = true; if (edtooltip.content.ajax.url.substring(0,7)!="http://") { edtooltip.content.ajax.url = edApplication().path + edtooltip.content.ajax.url; } edtooltip.content.ajax.type = 'GET'; edtooltip.content.ajax.data= { id: edtooltip.objid, type: edtooltip.objtype}; edtooltip.content.ajax.dataFilter= function(data, dataType) { return $.trim(data); }; edtooltip.content.ajax.success= function(data, status) { if (data == "") { el.qtip("destroy"); } else { this.set('content.text', data); } }; } return edtooltip; } function includeWebForm(container, rootPath, clientCode, seqNum, extraParameters) { //parse url to get the queryString if (!window.edeal) window.edeal = new Object(); window.edeal.webFormLoadedFromAnExternalWebSite = true; var urlToGetQueryStringParameters = rootPath + clientCode + "/service/wwwform/get/" + seqNum; if (extraParameters) { urlToGetQueryStringParameters += "?" + extraParameters; } var utk = getParameterByNameInUrl(urlToGetQueryStringParameters, "utk"); var design = getParameterByNameInUrl(urlToGetQueryStringParameters, "design"); window.edeal.utk = utk; window.edeal.design = design; window.edeal.HUBRootPath = rootPath; window.edeal.clientCode = clientCode; window.edeal.seqNum = seqNum; if (urlToGetQueryStringParameters) { $.support.cors = true; $.get(urlToGetQueryStringParameters, function(data) { container.html(data); //includeAllEngineJS(rootPath, function() { include(rootPath + "file/" + clientCode + "/wwwform/wwwForm.css", function(fn){ //var edmanager = new Managers.EdManager({ACCESS_MODE: "MODIFY", rootPath:rootPath + "file/common/wwwForm/include/"}); var edmanager = new Managers.EdManager({ACCESS_MODE: "MODIFY", rootPath:rootPath, subRootPath: "file/common/wwwForm/include/"}); }); //}); }) .error(function(jqXHR, textStatus, errorThrown) { console.error("jqXHR object :"); console.error(jqXHR); console.error("textStatus :"); console.error(textStatus); console.error("errorThrown : "); console.error(errorThrown); }); } } function getParameterByNameInUrl(url, name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( url ); if( results == null ) return ""; else return decodeURIComponent(results[1].replace(/\+/g, " ")); } function includeCSS(url) { if ( ( url != null ) && ( !document.getElementById( url ) ) ){ var oHead = document.getElementsByTagName('HEAD').item(0); var oCSSLink = document.createElement( "link" ); oCSSLink.rel = "stylesheet"; oCSSLink.type = "text/css"; oCSSLink.id = url; oCSSLink.href = url; oHead.appendChild( oCSSLink ); } } $.includeJS = function(url, options) { // allow user to set any option except for dataType, cache, and url options = $.extend(options || {}, { dataType: "script", cache: true, url: url }); // Use $.ajax() since it is more flexible than $.getScript // Return the jqXHR object so we can chain callbacks return jQuery.ajax(options); }; /* Function below are used by wall and MUST BE MOVED*/ function hide(viewId) { var view = edManager.getViewByID(viewId); view.$el.hide(); } function show(viewId) { var view = edManager.getViewByID(viewId); view.$el.show('slow'); } function toggleWall(el, expandImage) { var offsetLeft = el.offset().left; if (!window.edeal.originalWallLeft) window.edeal.originalWallLeft = offsetLeft; var newLeft = offsetLeft<0?"0px": window.edeal.originalWallLeft + "px"; el.animate({'left': newLeft}, 600 ); rollWallImage(expandImage); } function rollWallImage(expandImage) { var currentSrc = expandImage.attr("src"); var newSrc = currentSrc=="./skins/default/images/wall/wallExpand.png"?"./skins/default/images/wall/wallExpand_expanded.png":"./skins/default/images/wall/wallExpand.png"; expandImage.attr("src", newSrc); } function toggleCommentsZone(commentsView, commentInput) { if (commentsView) { if (commentsView.options.isshowed) { commentsView.hide(); } else { commentsView.show(); } } if (commentInput) { if (commentInput.options.isshowed) { commentInput.hide(); } else { commentInput.show(); commentInput.$el.focus(); } } } function addTarget(objId, objType) { $.ajax({ url: "add_target.fl", data: {objType: objType, objId: objId}, context: this, success: function(data) { console.log("Vous suivez désomais cet objet"); } }); }
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de