PageSourceSearch

https://www.martinberasategui.com/js/dedolib/dedolib.js

js martinberasategui.com collected 2026-10-02 10:05:14 UTC 33,094 bytes, 1,143 lines download raw bytes

1
2function getScriptPath() {
3  var scriptTags = document.getElementsByTagName('script');
4
5  return scriptTags[scriptTags.length - 1].src.split('?')[0].split('/').slice(0, -1).join('/') + '/';
6}
7var DL_WEB_ROOT = (getScriptPath().replace("js/dedolib/","").replace("js/",""));
8var idiomaJs = getCookie('lang') || 'es';
9
10(function($){$.toJSON=function(o)
11{if(typeof(JSON)=='object'&&JSON.stringify)
12return JSON.stringify(o);var type=typeof(o);if(o===null)
13return"null";if(type=="undefined")
14return undefined;if(type=="number"||type=="boolean")
15return o+"";if(type=="string")
16return $.quoteString(o);if(type=='object')
17{if(typeof o.toJSON=="function")
18return $.toJSON(o.toJSON());if(o.constructor===Date)
19{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
20hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
21if(o.constructor===Array)
22{var ret=[];for(var i=0;i<o.length;i++)
23ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
24var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
25name='"'+k+'"';else if(type=="string")
26name=$.quoteString(k);else
27continue;if(typeof o[k]=="function")
28continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
29return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
30{if(typeof(JSON)=='object'&&JSON.parse)
31return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
32{if(typeof(JSON)=='object'&&JSON.parse)
33return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
34return eval("("+src+")");else
35throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
36{if(string.match(_escapeable))
37{return'"'+string.replace(_escapeable,function(a)
38{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
39return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);
40
41/* Simple JavaScript Inheritance
42 * By John Resig http://ejohn.org/
43 * MIT Licensed.
44 */
45// Inspired by base2 and Prototype
46(function(){
47  var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
48  // The base Class implementation (does nothing)
49  this.Class = function(){};
50  
51  // Create a new Class that inherits from this class
52  Class.extend = function(prop) {
53    var _super = this.prototype;
54    
55    // Instantiate a base class (but only create the instance,
56    // don't run the init constructor)
57    initializing = true;
58    var prototype = new this();
59    initializing = false;
60    
61    // Copy the properties over onto the new prototype
62    for (var name in prop) {
63      // Check if we're overwriting an existing function
64      prototype[name] = typeof prop[name] == "function" && 
65        typeof _super[name] == "function" && fnTest.test(prop[name]) ?
66        (function(name, fn){
67          return function() {
68            var tmp = this._super;
69            
70            // Add a new ._super() method that is the same method
71            // but on the super-class
72            this._super = _super[name];
73            
74            // The method only need to be bound temporarily, so we
75            // remove it when we're done executing
76            var ret = fn.apply(this, arguments);        
77            this._super = tmp;
78            
79            return ret;
80          };
81        })(name, prop[name]) :
82        prop[name];
83    }
84    
85    // The dummy class constructor
86    function Class() {
87      // All construction is actually done in the init method
88      if ( !initializing && this.init )
89        this.init.apply(this, arguments);
90    }
91    
92    // Populate our constructed prototype object
93    Class.prototype = prototype;
94    
95    // Enforce the constructor to be what we expect
96    Class.prototype.constructor = Class;
97
98    // And make this class extendable
99    Class.extend = arguments.callee;
100    
101    return Class;
102  };
103})();
104
105
106/**
107* Funciones dedolib para los dialogos y alertas en pantalla
108*/
109function DL_messageInfo(){
110	return;
111	var winH = $(window).height();
112	var winW = $(window).width();
113	var ancho = $("body div:first-child").width() -100; 
114	$("#mensajeInfo").css('width',  ancho);
115
116	$("#mensajeInfo").css('top',  winH/2-$("#mensajeInfo").height()/2);
117	$("#mensajeInfo").css('left', winW/2-(ancho/2));
118	$('#mensajeInfo').fadeTo("fast",1.0);
119	
120	if($("#mensajeInfo li.info").length > 0){
121		setTimeout(function() { $('#mensajeInfo').fadeOut('slow'); }, 2000);
122	}else{
123    	$('#mensajeInfo').click(function(e) { desbloqueaWindow();});
124	}
125}
126
127function DL_showMask(){
128	if($("#DL_mask").length == 0){
129		$("<div/>", {
130			id:"DL_mask"
131		}).appendTo("body");
132	}
133	var maskHeight = $(document).height();
134	var maskWidth = $(window).width();
135	$('#DL_mask').css({'width':maskWidth,'height':maskHeight});
136    
137    $('.navbar').css({'z-index':20});
138    $('#DL_mask').fadeTo("fast",0.7);
139    // $('#DL_mask').click(function(e) { desbloqueaWindow();});
140}
141function DL_hideMask(){
142    $('.navbar').css({'z-index':1000});
143	$('#DL_mask').hide();
144}
145function DL_growlMessage(msg) {
146	if($("#DL_growl").length == 0){
147		$("<div/>", {
148			id:"DL_growl",
149			text: msg
150		}).appendTo("body");
151	}
152	var winH = $(window).height();
153	var winW = $(window).width();
154               
155	$("#DL_growl").css('top',  winH/2-$("#DL_growl").height()/2);
156	$("#DL_growl").css('left', winW/2-$("#DL_growl").width()/2);
157	$('#DL_growl').fadeTo("fast",0.9);
158}
159function DL_hideGrowlMessage(){
160	$('#DL_growl').hide();
161}
162function bloqueaWindow(){
163    DL_showMask();
164    DL_growlMessage(MENSAJES['enviando_datos']);
165}
166function desbloqueaWindow(){
167	DL_hideGrowlMessage();
168	DL_hideMask();
169}
170function alertaWin(msg) {
171	$("#alertaWin").remove();
172	if($("#alertaWin").length == 0){
173		$("<div/>", {
174			"class": "DLalerta",
175			id:"alertaWin",
176			"title": "Alerta",
177			text: ''
178		}).html('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 7px 60px 0;"></span>' + msg + '</p>').appendTo("body");
179	}
180	
181	$( "#alertaWin" ).dialog({
182			modal: false,
183			draggable: false,
184			resizable: false,
185			buttons: {
186				Ok: function() {
187					$( this ).dialog( "close" );
188				}
189			}
190		});
191	$( "#alertaWin" ).bind( "dialogclose", function(event, ui) {
192		desbloqueaWindow();
193	});
194}
195
196function DL_messageConfirm(msg,myFunc){
197	DL_showMask();
198	if($("#confirmWin").length == 0){
199		$("<div/>", {
200			"class": "DLconfirm",
201			id:"confirmWin",
202			"title": "Alerta",
203			text: ''
204		}).html('<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0px 7px 20px 0;"></span>' + msg + '</p>').appendTo("body");
205	}
206	$( "#confirmWin" ).dialog({
207			modal: false,
208			draggable: false,
209			resizable: false
210		});
211		
212	$('.ui-dialog :button').blur();
213	$( "#confirmWin" ).dialog( "option", "buttons",
214		[{	text: "Ok",
215        	id: 'okBT',
216        	click: myFunc
217    	},
218    	{	text: "Cancel",
219        	id: 'cancelBT',
220        	click: function() {$(this).dialog("close"); }
221    	}]);
222	$( "#confirmWin" ).bind( "dialogclose", function(event, ui) {
223		desbloqueaWindow();
224	});
225}
226
227
228
229
230/****************************************************
231 * Funciones de submit
232 ****************************************************/
233
234function FormSubmitter(formName, formCbs)
235{
236	this.formName = formName;
237	this.form = document[formName];
238	this.formCbs = formCbs;
239}
240
241/**
242 * Comproba los datos antes de ejecutar la acci�n.
243 * Se suele utilizar para modificar un registro desde la ficha.
244 */
245FormSubmitter.prototype.valida_busca = function(accion)
246{
247	
248	this.form.accion.value = accion;
249	this.form.issearch.value = 1;
250	oFormCallbacks.validateInServerForm();
251	return false;
252	
253	if (this.formCbs.isValidAlert() && this.formCbs.isCompleteAlert()) {
254		this.form.accion.value = accion;
255		this.form.issearch.value = 1;
256		this.formCbs.submit();
257		this.form.submit();
258		//return true;
259	}
260	return false;
261}
262
263/**
264 * Comproba los datos antes de ejecutar la acci�n.
265 * Se suele utilizar para modificar un registro desde la ficha.
266 */
267FormSubmitter.prototype.valida_ejecuta = function(accion)
268{
269	bloqueaWindow();
270	this.form.accion.value = accion;
271	oFormCallbacks.validateInServerForm();
272	return false;
273}
274
275/**
276 * Comproba los datos antes de ejecutar la acci�n.
277 * Se suele utilizar para modificar un registro desde la ficha.
278 */
279FormSubmitter.prototype.valida_ejecuta_tab = function(accion,regMatch)
280{
281	this.form.accion.value = accion;
282	oFormCallbacks.validateInServerForm(regMatch);
283	return false;
284}
285
286
287/**
288 * Ejecuta la acci�n sin confirmaci�n ni comprobaci�n.
289 * Sin pasar el id: se suele utilizar para volver al listado.
290 * Pasando el id: Se suele utilizar para ir del listado a una ficha.
291 */
292FormSubmitter.prototype.ejecuta = function(accion, id)
293{
294	this.form.accion.value = accion;
295	this.form.id.value = id;
296	this.form.submit();
297	return false;
298}
299
300FormSubmitter.prototype.ejecutaInNewWindow = function(accion, id)
301{
302	var odlAccion = this.form.accion.value;
303	var oldId = this.form.id.value;
304
305	this.form.target = "_blank";
306	this.form.accion.value = accion;
307	this.form.id.value = id;
308	this.form.submit();
309	this.form.target = "_self";
310
311	this.form.accion.value = odlAccion;
312	this.form.id.value = oldId;
313	return false;
314}
315
316
317FormSubmitter.prototype.ejecutaInNewWindowNewDest = function(accionNew, id, newUrl)
318{
319	var odlAccion = this.form.accion.value;
320	var oldId = this.form.id.value;
321	
322	this.form.action = newUrl;
323	this.form.target = "_blank";
324	this.form.accion.value = accionNew;
325	this.form.id.value = id;
326	this.form.submit();
327	this.form.target = "_self";
328	this.form.action = '';
329	
330	this.form.accion.value = odlAccion;
331	this.form.id.value = oldId;
332	return false;
333}
334
335FormSubmitter.prototype.openInNewWindow = function(newUrl)
336{
337	this.form.action = newUrl;
338	this.form.target = "_blank";
339	this.form.submit();
340	return false;
341}
342
343/**
344 * Cambia el target del form.
345 */
346FormSubmitter.prototype.setTarget = function(dest)
347{
348	this.form.action = dest;
349	
350}
351
352/**
353 * Pide una confirmaci�n antes de ejecutar la acci�n.
354 * Sin pasar id: Se suele utilizar para eliminar un registro desde la ficha.
355 * Pasando un id: Se suele utilizar para eliminar un registro desde el listado.
356 */
357FormSubmitter.prototype.confirma = function(accion, id)
358{
359	var accionTest = accion;
360	if (accion.indexOf('.') > 0) {
361		accionTest = accion.split('.');
362		accionTest = accionTest[1];
363	}
364	
365	if (accionTest.substr(0,3) == "del") {
366		//"Confirme que desea eliminar el registro.";
367		msg = MENSAJES['confirmDel'];
368	}
369	
370	if (accionTest.substr(0,4) == "send") {
371		//"Confirme que desea enviar el registro";
372		msg = MENSAJES['confirmSend'];
373	}
374	
375	var okFunc = function() { $(this).dialog("close");s.ejecuta(accion, id); return true; }
376	DL_messageConfirm(msg,okFunc);
377	return false;
378}
379
380
381FormSubmitter.prototype.autoSave = function(accion, id)
382{
383	msg = MENSAJES['confirmAutoSave'];
384	
385	var okFunc = function() { $(this).dialog("close");s.valida_ejecuta(accion, id); return true; }
386	DL_messageConfirm(msg,okFunc);
387	return false;
388}
389
390
391/**
392 * Pide una confirmaci�n antes de eliminar una foto.
393 */
394FormSubmitter.prototype.eliminar_foto = function(memname)
395{
396	if ( confirm(MENSAJES['confirmDelFile']) ) {
397		this.form.accion.value = "delfoto:" + memname;
398		this.form.submit();
399	}
400}
401
402FormSubmitter.prototype.eliminar_fotoAjax = function(memname)
403{
404	var msg = MENSAJES['confirmDelFile'];
405	var formu = this.form;
406	
407	var okFunc = function() { 
408				$(this).dialog("close");
409				var oldAccion = formu.accion.value;
410				formu.accion.value = "ajaxDelfoto:" + memname;
411				var valsForm = $('#f').serialize();
412				valsForm = valsForm.split('accion_').join('boton_');
413				formu.accion.value = oldAccion;
414				var urlString = valsForm;
415				$.ajax({
416					type: "POST",
417					url: formu.action,
418					data: urlString,
419					dataType : 'html',
420					success: function(msg){
421						document.f.elements[memname].value = 0;
422						$('#contenedor_' + memname).slideUp('fast');
423						
424						$('#mensajeInfo').remove();
425						$("body").append(msg);
426						DL_messageInfo();
427					}
428				});
429				return true;
430				}
431	DL_messageConfirm(msg,okFunc);
432	return false;
433}
434
435/**
436 * Pide una confirmaci�n antes de eliminar una foto.
437 */
438FormSubmitter.prototype.eliminar_file = function(memname)
439{
440	if ( confirm(MENSAJES['confirmDelFile']) ) {
441		this.form.accion.value = "delfile:" + memname;
442		this.form.submit();
443	}
444}
445
446FormSubmitter.prototype.eliminar_fileAjax = function(memname)
447{
448	var msg = MENSAJES['confirmDelFile'];
449	var formu = this.form;
450	
451	var okFunc = function() { 
452				$(this).dialog("close");
453				var oldAccion = formu.accion.value;
454				formu.accion.value = "ajaxDelfile:" + memname;
455				var valsForm = $('#f').serialize();
456				valsForm = valsForm.split('accion_').join('boton_');
457				formu.accion.value = oldAccion;
458				var urlString = valsForm;
459				$.ajax({
460					type: "POST",
461					url: formu.action,
462					data: urlString,
463					dataType : 'html',
464					success: function(msg){
465						document.f.elements['F_' + memname].value = '';
466						$('#contenedor_' + memname).slideUp('fast');
467						$('#contenedor_' + memname + '_imgprev').slideUp('fast');
468						$('#mensajeInfo').remove();
469						$("body").append(msg);
470						DL_messageInfo();
471					}
472				});
473				return true;
474				}
475	DL_messageConfirm(msg,okFunc);
476	
477	return false;
478}
479
480/**
481 * Recarga la p�gina ajustando el orden de la columna 'by'.
482 */
483FormSubmitter.prototype.paginate = function(by)
484{
485	var currBy = this.form.orderBy.value;
486	if (currBy == by) {
487		this.form.orderDir.value =
488			(this.form.orderDir.value == 'DESC') ? 'ASC' : 'DESC';
489	} else {
490		this.form.orderDir.value = 'ASC';
491	}
492	this.form.orderBy.value = by;
493	
494	this.form.submit();
495}
496
497// pone a 0 el formulario dejando los hidden sin resetear
498function resetForm(objForm)
499{
500	for(var i = 0;i < objForm.elements.length;i ++){
501		var obj = objForm.elements[i];
502		switch(obj.type){
503			case "select-one":
504				if(obj.name != 'regsPerPage'){
505					obj.selectedIndex = 0;
506				}
507				break;
508			case "select-multiple":
509				obj.selectedIndex = -1;
510				break;
511			case "checkbox":
512				obj.checked = false;
513				break;
514			case "text":
515				var hiddenId = obj.id.substr(5,100);
516				$('#'+hiddenId).value = '';
517				
518				obj.value = "";
519				break;
520			case "file":
521			case "textarea":
522				obj.value = "";
523				break;
524		}
525		
526	}
527	return false;
528}
529
530
531
532function multiselSelect(elName,onOff)
533{
534	if(!$('#'+elName).length) return;
535	if(onOff !== false) onOff = true;
536	var selFrom = document.f[elName + "[]"];
537	var optFrom = selFrom.options;
538	for(var f=0; f<optFrom.length; f++) {
539		optFrom[f].selected = onOff;
540	}
541}
542
543
544var MemberDedoLib = Class.extend({
545	init: function(formElementName, pTipo, pFormat, pRequired, pTitle, pEnabled, pValidateFunc) {
546    	var $this = this;
547    	this.a_name = this.getMemberName(formElementName);
548    	this.campoUser = $('#'+this.a_name); // el campo que rellena el usuario. normalmente el mismo id, a veces cambia el id (fecha, autocomplete)
549		this.element = $('#'+this.a_name);		// el elemento que se usa para almacenar el valor real (p.ej. en autocomplete el valor real  esta en un hidden)
550		this.memNameForLabel = this.a_name;
551		if((this.a_tipo=='multienum' || this.a_tipo=='multiforkey') && this.a_format == 'select'){
552			this.memNameForLabel = this.a_name.substr(0,this.a_name.length-2);
553		}	
554		
555		
556		if(pTipo == 'date'){
557			this.element = $('#H_'+this.a_name);
558			this.campoUser = $('#H_'+this.a_name);
559		}
560		if(pFormat == 'autocomplete') this.campoUser = $('#auto_'+this.a_name);
561
562		this.a_tipo = pTipo;
563		this.a_format = pFormat;
564		this.a_required = pRequired;
565		this.a_title = pTitle;
566		this.a_enabled = false;
567		
568		this.a_accesibleVal = '';
569		if(this.element.is('.accesibleVal')){
570			this.a_accesibleVal = this.campoUser.val();
571		}
572		if(pEnabled == '1') this.a_enabled = true;
573	
574		var validateFunc = '';
575		if(pValidateFunc) validateFunc = pValidateFunc;
576		this.a_validateFunc = validateFunc;
577		
578		this.hasError = false;
579		if(pFormat == 'ckeditor'){
580			setTimeout(function() { $this.initCKEDITOR();} , 1000);
581			this.campoUser.change(function() {
582				$this.validateInServer();
583			});
584		}else{
585			if(pFormat == 'radio' || pFormat == 'checks') {
586				$("input[name*='"+this.a_name+"']").each(function(k,el){
587					$this.campoUser = $(el);
588					$(el).change(function(){
589						$this.validateInServer();
590					});
591				});
592			}else{
593				if((this.a_tipo=='multienum' || this.a_tipo=='multiforkey') && this.a_format == 'select'){
594					// el change / validacion se hace desde la funcion que mueve los items
595				}else{
596					this.campoUser.change(function() {
597						$this.validateInServer();
598					});
599				}
600			}
601		}
602
603	},
604   
605	initCKEDITOR: function() {
606		var $this = this;
607		if (typeof CKEDITOR == 'undefined') return;
608		var editor = CKEDITOR.instances[this.a_name];
609		if(editor) {
610			editor.on( 'blur', function(e) { 
611								// $this.validateInServer();
612								$('#'+$this.a_name).html(this.getData());
613								$('#'+$this.a_name).trigger('change');
614							});
615		}
616	},
617   
618	getMemberName: function(formElementName) {
619		var arr = formElementName.split("[");
620		formElementName = arr[0];
621		formElementName = formElementName.replace('Out','In');
622		return formElementName;
623	},
624   
625	setRequired: function(req) {
626		var $this = this;
627		this.a_required = req;
628		if(req){
629			$this.assignLabel('required');
630		}else{
631			$this.assignLabel('optional');
632		}
633		$this.validateInServer();
634	},
635   
636   onSubmitMember: function() {
637		var valSerialize = '';
638		var member = this.a_name;
639		if(this.a_accesibleVal && $('#'+member).val() == this.a_accesibleVal){
640			$('#'+member).val("");
641		}
642		if((this.a_tipo=='multienum' || this.a_tipo=='multiforkey') && this.a_format == 'select'){
643			multiselSelect(member);
644		}		
645		if((this.a_tipo == 'foto' || this.a_tipo == 'file' || this.a_tipo == 'video')){
646			valSerialize = '&valSer_' + member + '=' + (this.element.val());
647			if ( window.FileReader && window.File && window.FileList && window.Blob ) {
648			    //Supported
649			    var valSize = ($('#'+member)[0].files[0]) ? $('#'+member)[0].files[0].size : 0;
650			    $('#ffilesize_'+member).val(valSize);
651			}
652		}
653		
654		if((this.a_tipo=='text') && this.a_format == 'RTE'){
655			// puede que este asi definido pero el navegador no soporte el RTE
656			if($('hdn' + member)){
657				updateRTE(member);
658				var textoRte = $('#hdn' + member).val();
659				valSerialize += '&valSer_' + member + '=' + (textoRte);
660			}
661		}
662		
663		if((this.a_tipo=='text') && this.a_format == 'FCK'){
664			// puede que este asi definido pero el navegador no soporte el RTE
665			if(!(isSafari)){ 
666					if(FCKeditorAPI.GetInstance(member).GetXHTML() != ''){
667						this.element.val('OK');
668						var textoRte = $('#'+member).val();
669					}
670				}else{
671					var textoRte = document.f.elements[member].value;
672				}
673			
674			valSerialize += '&valSer_' + member + '=' + (textoRte);
675		}
676		
677		return valSerialize;
678   },
679   
680	validateInServer: function() {
681   		if(this.a_enabled == false) return;
682		var $this = this;
683   		var member = this.a_name;
684		var valSerialize = this.onSubmitMember();
685		var valsForm = $('#f').serialize();
686		
687		var dataMember = {};
688		$.each(['a_tipo','a_format','a_required','a_title','a_accesibleVal','a_validateFunc'], function(k,v) {
689			dataMember[v] = $this[v];
690		});
691		
692		var paramsMember = $.param(dataMember);
693		var urlString = 'accionJS=validaMember&member='+member + '&' + paramsMember + '&' + valsForm + '&' + valSerialize;
694		$.ajax({
695			type: "POST",
696			url: DL_WEB_ROOT+'utilidades/validator.php',
697			data: urlString,
698			dataType : 'html',
699			success: function(msg){
700				$this.showResponse(msg);
701			}
702		});
703	},
704   
705	showResponse: function(msg) {
706		this.hasError = false;
707		var $this = this;
708		if(msg == 'OKY'){
709			$(this.campoUser).closest( ".form-group" ).removeClass('has-error');
710			$(this.campoUser).closest( ".form-group" ).addClass('has-success');
711			//$this.assignLabel('complete');
712			// this.element.blur();
713			this._closePrompt();
714		}else{
715			$(this.campoUser).closest( ".form-group" ).removeClass('has-success');
716			$(this.campoUser).closest( ".form-group" ).addClass('has-error');
717			// this.element.val(msg);
718			// $this.assignLabel('problem');
719			this.element.blur();
720			this._buildPrompt(msg);
721		}
722	},
723   
724	assignLabel: function(tipoLabel) {
725   		var elImg = $('#L__'+this.memNameForLabel +' > img');
726		elImg.attr('alt',MENSAJES[tipoLabel]);
727		elImg.attr('src', DL_WEB_ROOT+'images/dedolib/'+tipoLabel+'.gif');
728	},
729       
730        _closePrompt: function() {
731        	var $this = this;
732            if (this.prompt)
733                this.prompt.fadeTo("fast", 0, function() {
734                    $this.prompt.remove();
735                    $this.prompt = null;
736                });
737        },
738
739        _buildPrompt: function(promptText) {
740			if(!oFormCallbacks.config.showErrorsText) return;
741			if(this.prompt){
742				$(this.prompt).find('.formErrorContent').html(promptText);
743				return;
744			}
745			var $this = this;
746			var promptPos = oFormCallbacks.config.errorPosition || "topLeft";
747			var options = {	showArrow:true
748							,promptPosition: promptPos}
749							
750            // create the prompt
751            var prompt = $('<div>');
752            prompt.addClass("help-block");
753
754            // create the prompt content
755            var promptContent = $('<div>').addClass("formErrorContent").html(promptText).appendTo(prompt);
756            
757            
758			prompt.click(function(e) { $this._closePrompt();$this.campoUser.focus();});
759            this.prompt = prompt;
760            //$("body").append(prompt);
761			$(this.campoUser).closest( 'div[class^="col-"]' ).append(prompt);
762
763            //var pos = $this._calculatePosition($(this.campoUser), prompt, options);
764            prompt.css({
765                //"top": pos.callerTopPosition,
766                //"left": pos.callerleftPosition,
767                //"marginTop": pos.marginTopSize,
768                "opacity": 0
769            });
770
771            return prompt.animate({
772                "opacity": 0.87
773            });
774
775        },
776        _calculatePosition: function(field, promptElmt, options) {
777			if(this.a_format == 'radio' || this.a_format == 'checks' || this.a_format == 'ckeditor') {
778				// uso el label
779				field = $('#L__'+this.memNameForLabel);
780			}
781            var promptTopPosition, promptleftPosition, marginTopSize;
782            var fieldWidth = field.width();
783            var promptHeight = promptElmt.height();
784			
785            var offset = field.offset();
786            if(offset == null) alert(this.a_name);
787            promptTopPosition = offset.top;
788            promptleftPosition = offset.left;
789            marginTopSize = 0;
790
791            switch (options.promptPosition) {
792
793                default:
794                case "topRight":
795                    promptleftPosition += fieldWidth - 25;
796                    promptTopPosition += -promptHeight;
797                    break;
798                case "topLeft":
799                    promptTopPosition += -promptHeight - 10;
800                    break;
801                case "centerRight":
802                    promptleftPosition += fieldWidth + 13;
803                    break;
804                case "bottomLeft":
805                    promptTopPosition = promptTopPosition + field.height() + 15;
806                    break;
807                case "bottomRight":
808                    promptleftPosition += fieldWidth - 25;
809                    promptTopPosition += field.height() + 5;
810            }
811
812            return {
813                "callerTopPosition": promptTopPosition + "px",
814                "callerleftPosition": promptleftPosition + "px",
815                "marginTopSize": marginTopSize + "px"
816            };
817        }
818  
819});
820
821
822
823/****************************************************
824 * FormCallbacks
825 ****************************************************/
826
827/**
828 * FormCallbacks
829 * 
830 * @param string nombre del formulario
831 */
832var FormCallbacks = Class.extend({
833  init: function(formName){
834    	this.formName = formName;
835		this.configMembers = {};
836		this.config = {};
837  },
838
839   setConfig: function(pShowErrorsText,pErrorPosition) {
840		this.config.showErrorsText = false;
841		if(pShowErrorsText == '1') this.config.showErrorsText = true;
842		this.config.errorPosition = pErrorPosition;
843   },
844   
845   addValidateCallback: function(formElementName, pTipo, pFormat, pRequired, pTitle, pEnabled, pValidateFunc) {
846		this.configMembers[formElementName] = new MemberDedoLib(formElementName, pTipo, pFormat, pRequired, pTitle, pEnabled, pValidateFunc);
847   },
848   
849   enable: function(formElementName) {
850		this.configMembers[formElementName].a_enabled = true;
851   },
852   
853   disable: function(formElementName) {
854		this.configMembers[formElementName].a_enabled = false;
855   },
856   
857   setRequired: function(formElementName,req) {
858		this.configMembers[formElementName].setRequired(req);
859   },
860   
861   setValid: function(formElementName) {
862		this.configMembers[formElementName].showResponse('OKY');
863   },
864   
865   validateMember: function(formElementName) {
866		this.configMembers[formElementName].validateInServer();
867   },
868   
869   observeForm: function() {
870		// los elementos se 'observan' ellos mismos
871		return;
872   },
873   validateInServerForm: function(regMatch) {
874		var valSerialize = '';
875		var $this = this;
876		var isTab = false;
877		if(regMatch){
878			var re = new RegExp(regMatch,"gm");
879			isTab = true;
880		}
881		var serStr = '';
882		var result = {};
883		
884		for(var i in this.configMembers){
885			if(isTab){
886				if (!(i.match(re))) continue;
887			}
888			
889			member = this.configMembers[i];
890			if(!member.a_enabled) continue;
891
892			valSerialize += this.configMembers[i].onSubmitMember();
893			
894			var dataMember = {};
895			$.each(['a_tipo','a_format','a_required','a_title','a_accesibleVal','a_validateFunc'], function(k,v) {
896				dataMember[v] = $this.configMembers[i][v];
897			});
898			
899			result[i] = dataMember;
900		}
901		
902		var valsForm = $('#f').serialize();
903		var vals = $.toJSON(result);
904		var params = {} ;
905		params.accionJS = 'validaForm';
906		params.config = vals;
907		var urlString = valsForm + '' + valSerialize + '&' + $.param(params);
908		// alert(urlString);
909		// params += valSerialize;
910		$.ajax({
911			type: "POST",
912			url: DL_WEB_ROOT+'utilidades/validator.php',
913			data: urlString,
914			dataType : 'json',
915			success: function(msg){
916				// alert( "Data Saved: " + msg );
917				//$this.showResponse(msg);
918				var hasError = false;
919				for (var i in msg) {
920					var res = msg[i];
921					$this.configMembers[i].showResponse(res);
922					if(res != 'OKY' && res.substr(0,9) != "##alert##"){ 
923						hasError = true;
924					}
925				}
926				if(hasError){
927					DL_hideGrowlMessage();
928					alertaWin(MENSAJES['error_form']);
929				}else{
930					s.form.submit();
931				}
932			}
933		});
934   }
935});
936
937
938/****************************************************
939 * MISC
940 ****************************************************/
941///////////////////////////////////////////////////////////////////////////
942// MOVESELECTBOX
943///////////////////////////////////////////////////////////////////////////
944function moveFromTo(fbox,tbox){
945	for(var i=0; i<fbox.options.length; i++) {
946		if(fbox.options[i].selected && fbox.options[i].value != "") {
947			var no = new Option();
948			no.value = fbox.options[i].value;
949			no.text = fbox.options[i].text;
950			tbox.options[tbox.options.length] = no;
951			fbox.options[i] = null;
952      		i--;
953   		}
954	}
955	SortD(tbox);
956	
957	if(fbox.name.substr(fbox.name.length-5,100) == 'Out[]'){
958		var mem = (tbox.id);
959		oFormCallbacks.setValid(mem);
960	}else{
961		var mem = (fbox.id);
962		oFormCallbacks.validateMember(mem); // hace un bucle??
963	}
964}
965
966
967function SortD(box)  {
968	var temp_opts = new Array();
969	var temp = new Object();
970	for(var i=0; i<box.options.length; i++)  {
971		temp_opts[i] = box.options[i];
972	}
973	
974	temp_opts.sort(function (a,b) {
975				if((a.text.toUpperCase()) < (b.text.toUpperCase())){
976					return -1;
977				}
978				if((a.text.toUpperCase()) > (b.text.toUpperCase())){
979					return 1;
980				}
981				return 0;
982		});
983	
984	box.options.length = 0;
985	for(var i=0; i<temp_opts.length; i++)  {
986		box.options[i] = temp_opts[i];
987	}
988}
989
990///////////////////////////////////////////////////////////////////////////
991// END MOVESELECTBOX
992///////////////////////////////////////////////////////////////////////////
993
994/**
995 * Gets the value of the specified parameter in the cookie.
996 *
997 * @param string name of the desired parameter.
998 * @return string value of that parameter or null if cookie does not exist.
999 */
1000function getCookie(name)
1001{
1002    var dc = document.cookie;
1003    var prefix = name + "=";
1004    var begin = dc.indexOf("; " + prefix);
1005    if (begin == -1)
1006    {
1007        begin = dc.indexOf(prefix);
1008        if (begin != 0) return null;
1009    }
1010    else
1011    {
1012        begin += 2;
1013    }
1014    var end = document.cookie.indexOf(";", begin);
1015    if (end == -1)
1016    {
1017        end = dc.length;
1018    }
1019    return unescape(dc.substring(begin + prefix.length, end));
1020}
1021
1022function to_permalink(camposArr,permaFieldId) {
1023	var str = '';
1024	for ( i = 0; i < camposArr.length; i++ ) {
1025		if(i>0) str += ' ';
1026		var inputType = $('#'+camposArr[i]+' option:selected').text();
1027		if(inputType != ''){
1028			str += inputType;
1029		}else{
1030			str += $('#'+camposArr[i]).val();
1031		}
1032		
1033	}
1034	var params = { accion: 'toPermalink',q:str };
1035	var urlString = $.param(params);
1036	$.ajax({
1037			type: "POST",
1038			url: DL_WEB_ROOT+'utilidades/ctrl_XMLHttpRequest.php',
1039			data: urlString,
1040			dataType : 'html',
1041			success: function(msg){
1042				// alert( "Data Saved: " + msg );
1043				$('#'+permaFieldId).val(msg);
1044				oFormCallbacks.setValid(permaFieldId);
1045			}
1046		});
1047}
1048
1049// creamos el objeto
1050var oFormCallbacks = new FormCallbacks('f');
1051
1052var isSafari = (/Konqueror|Safari|KHTML/.test(navigator.userAgent));
1053$(function(){
1054	var selPerPage = '<select id="regsPerPage" name="regsPerPage" title="'+MENSAJES['registros_por_pagina']+'">';
1055			selPerPage += '<option value="5">5 p.p.<\/option>';
1056			selPerPage += '<option value="10">10 p.p.<\/option>';
1057			selPerPage += '<option value="20" selected="selected">20 p.p.<\/option>';
1058			selPerPage += '<option value="40">40 p.p.<\/option>';
1059			selPerPage += '<option value="100">100 p.p.<\/option>';
1060			selPerPage += '<option value="250">250 p.p.<\/option>';
1061			selPerPage += '<option value="300000">'+MENSAJES['todos']+'<\/option>';
1062			selPerPage += '<\/select>';
1063	$("#contPageListJS").append(selPerPage);
1064	$('#regsPerPage').val($('#perPage').val());
1065
1066	$("#regsPerPage").change(function(){$('#perPage').val($(this).val());document.f.submit();});		
1067	// $( "#regsPerPage" ).tooltip();
1068});
1069
1070function goPaginatorPage(regNum)
1071{
1072	if(document.f){
1073		document.f['regIni'].value = regNum;
1074		document.f.submit();
1075		return false;
1076	}
1077}
1078
1079// funciones zUploader
1080var zUploadWin;
1081function openzUploader(data) {
1082	zUploadWin = window.open(DL_WEB_ROOT+"zUpload/app/", "zUploadWin", "width=1224, height=800,scrollbars=1");
1083					
1084	var form=$("<form/>").attr({
1085		method: "post",
1086		action: DL_WEB_ROOT+"zUpload/app/index.php",
1087		target: "zUploadWin"
1088	});
1089	form.append($("<input/>").attr({name:"memName",value:data.memName}));
1090	form.append($("<input/>").attr({name:"extensions",value:data.extensions}));
1091	form.append($("<input/>").attr({name:"wG",value:data.wG}));
1092	form.append($("<input/>").attr({name:"hG",value:data.hG}));
1093	form.append($("<input/>").attr({name:"wM",value:data.wM}));
1094	form.append($("<input/>").attr({name:"hM",value:data.hM}));
1095	form.append($("<input/>").attr({name:"exactSize",value:data.exactSize}));
1096	$("body").append(form);
1097	form.submit();
1098	form.remove();
1099	return false;
1100}
1101				
1102function DLImgUpload(obj) {
1103	var memName = obj.memName;
1104
1105	zUploadWin.close();
1106	$("#grande_"+memName).html("<img src=\'../zUpload/app/uploads/"+obj.grande+"\' />");
1107	if(obj.mini){
1108		$("#mini_"+memName).html("<img src=\'../zUpload/app/uploads/"+obj.mini+"\' />");
1109	}
1110	$("#"+memName).val(111);
1111	$("#"+memName+"_zUpload").val(obj.filename);
1112	$("#"+memName+"_originalFilename").val(obj.originalFilename);
1113	$('#contenedor_' + memName).show();			
1114	return;
1115}
1116
1117
1118// fin zUploader
1119$(function(){
1120	$('.accesibleVal').focus(function() {
1121		var input = $(this);
1122		if (input.val() == $(this).attr('startVal')) {
1123			input.val('');
1124		}
1125	}).blur(function() {
1126		var input = $(this);
1127		if(!$(this).attr('startVal')) $(this).attr('startVal',input.val());
1128		if (input.val() == '' || input.val() == $(this).attr('startVal')) {
1129			input.val($(this).attr('startVal'));
1130		}
1131	}).blur();
1132	
1133	$(".zebra tr").mouseover(function(){$(this).addClass("ruled");}).mouseout(function(){$(this).removeClass("ruled");});
1134	$(".zebra tr:even").addClass("par");
1135	$(".datepicker").datepicker("option",$.datepicker.regional[idiomaJs]);
1136	$(".datepicker").datepicker({dateFormat:'dd-mm-yy',firstDay: 1 });
1137	$(".datetimepicker").datetimepicker({dateFormat:'dd-mm-yy', timeFormat: "HH:mm"});
1138	
1139	$('#showBuscar').click(function() {
1140		 $('#cajaSearch').slideToggle('fast');
1141	});
1142	DL_messageInfo();
1143});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.