PageSourceSearch

https://nvp3d.com/_modules/imhotep/scripts/js/Imhotep.js?v20131216

js nvp3d.com collected 2026-10-06 18:26:45 UTC 34,596 bytes, 1,000 lines download raw bytes

1Ext.ns('Imhotep');
2
3/**
4 * Merge deux wordings ensemble
5 *
6 * @param Object base
7 * @param Object override
8 * @return Object la base modifiee avec les wording de l'override
9 */
10Imhotep.applyWording = function(base, override) {
11    if (!base) base = {};
12    if (!override) override = {};
13    base.wording = Ext.apply(base.wording || {}, override.wording || {});
14    return base;
15};
16
17Imhotep.toast = function(config) {
18    var config = config || {};
19    var internal_config = {
20        title: 'Message',
21        autoDestroy: true,//default = true
22        autoHeight: true,
23        autoHide: true,//default = true
24        bodyStyle: 'text-align:center; padding: 10px;',
25        handleHelp: function(){
26        //console.info('help requested');
27        },
28        hideFx: {
29            delay: 5000,
30            //duration: 0.25,
31            mode: 'standard',//null,'standard','custom',or default ghost
32            useProxy: false //default is false to hide window instead
33        },
34        html: 'No message...',
35        iconCls: 'icon-info',
36
37        //optionally enable sound...see http://efattal.fr/extjs/examples/toastwindow/
38        //if you want to enable sound with this
39        /*
40        listeners: {
41            'beforerender': function() {
42                Sound.enable();
43                Sound.play(this.config.path.component + 'burp.wav');
44                Sound.disable();
45            },
46            scope: this
47        },
48        */
49
50        showFx: {
51            delay: 0,
52            //duration: 0.5, //defaults to 1 second
53            mode: 'standard',//null,'standard','custom',or default ghost
54            useProxy: false //default is false to hide window instead
55        },
56        width: 250 //optional (can also set minWidth which = 200 by default)
57    };
58    Ext.applyIf(config, internal_config);
59    new Ext.ux.window.MessageWindow(config).show(Ext.getDoc());
60},
61
62Imhotep.Ajax = {
63
64    /**
65     * Tableau des codes HTTP dont on ne veut pas en afficher l'erreur par
66     * cette classe, parce qu'elle est geree ailleurs (par exemple le cas
67     * du testeur d'autentification)
68     * @var array
69     */
70    skippedStatus: [],
71
72    /**
73     * Methode generale qui affiche un probleme en cas de non succes du script
74     * mais de succes quand meme au niveau du dialogue client-serveur
75     *
76     * @param object cfg un objet de config pour la boite de message
77     * @return void
78     */
79    unsuccess: function(cfg) {
80        var c = cfg || {};
81        Ext.Msg.show(Ext.apply({
82            title   : c.title || 'Error',
83            msg     : c.msg || c.error || c.message || 'Error',
84            buttons : Ext.Msg.OK,
85            icon    : Ext.Msg.ERROR,
86            width   : 400
87        }, c));
88    },
89
90    /**
91     * Methode generale qui affiche un probleme en cas de non succes du
92     * dialogue client-serveur
93     *
94     * @param XmlHttpRequest response
95     * @param Object cfg
96     * @return void
97     */
98    failure: function(response, cfg) {
99        // si le status vaut "non autorise", on skip la failure
100        for (var i = 0; i < Imhotep.Ajax.skippedStatus; i++) {
101            if (response.status == Imhotep.Ajax.skippedStatus[i]) return;
102        }
103
104        // autrement, on gere le message d'erreur
105        var str = '';
106        if (Ext.isObject(response)) {
107            for (var i in response) {
108                str += i + ' : ' + response[i];
109            }
110        }
111        Imhotep.Ajax.unsuccess(Ext.apply({
112            msg: str,
113            title: response.statusText
114        }, cfg || {}));
115    },
116
117    /**
118     * Affiche une erreur de maniere comprehensible
119     *
120     * @param Exception e
121     * @param Object cfg
122     * @return void
123     */
124    error: function(e, cfg) {
125        cfg = cfg || {};
126        // autrement, on gere le message d'erreur
127        var str = '';
128        for (var i in e) {
129            if (!cfg.stack && i === 'stack') continue;
130            str += i + ' : ' + e[i] + '<br/>';
131        }
132        Imhotep.Ajax.unsuccess(Ext.apply({
133            msg: str,
134            title: 'error'
135        }, cfg || {}));
136    },
137
138    /**
139     * Retourne le json de la reponse serveur
140     *
141     * Necessite que le json ait une cle "success" qui vaudra true ou false
142     * et une cle "error" si "success" = false
143     *
144     * @param XMLHttpRequest response
145     * @param boolean setSuccessIfUndefined mettre true pour setter automatiquement json.success a true s'il n'est pas defini
146     * @return Object
147     */
148    getJsonResponse: function(response, setSuccessIfUndefined) {
149        var json = {};
150        try {
151            json = Ext.decode(response.responseText);
152            // si le success n'est pas defini, on le set a true, signifiant
153            // que tout est ok
154            if (setSuccessIfUndefined && !Ext.isDefined(json.success)) {
155                json.success = true;
156            }
157        } catch(e) {
158            json = {success: false, error: response.responseText};
159        }
160        return json;
161    }
162
163};
164
165Imhotep.lib = {
166    
167    /**
168     * ----------------------------------------------------------------------------
169     *                METHODS
170     * ----------------------------------------------------------------------------
171     */
172    
173    /**
174     * Load a js file in the HTML flow
175     *
176     * @param string className the classname of the file to load (like Zend_Loader)
177     * @return void
178     */
179    loadClass: function(className, path) {
180        var tmp = className.split('_');
181        // remove 1st index (because it's the "jscripts" folder)
182        tmp.shift();
183        var libraryName = path + tmp.join('/') + '.js';
184        // inserting via DOM fails in Safari 2.0, so brute force approach
185        document.write('<script type="text/javascript" src="' + libraryName + '"></script>');
186    },
187    /**
188     * Load an array of js files in the HTML flow
189     *
190     * @param array classes classnames to load (like Zend_Loader)
191     * @return void
192     */
193    loadClasses: function(classes, path) {
194        for (var i = 0; i < classes.length; i++) {
195            Imhotep.lib.loadClass(classes[i], path);
196        }
197    },
198	
199    is_object: function( mixed_var ){
200        // http://kevin.vanzonneveld.net
201        // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
202        // +   improved by: Legaev Andrey
203        // +   improved by: Michael White (http://crestidg.com)
204        // *     example 1: is_object('23');
205        // *     returns 1: false
206        // *     example 2: is_object({foo: 'bar'});
207        // *     returns 2: true
208        // *     example 3: is_object(null);
209        // *     returns 3: false
210	 
211        if(mixed_var instanceof Array) {
212            return false;
213        } else {
214            return (mixed_var !== null) && (typeof( mixed_var ) == 'object');
215        }
216    },
217
218    applyAmbiguous: function(object, ambiguous) {
219        if (Ext.isArray(ambiguous)) {
220            ambiguous = {};
221        }
222
223        return Ext.apply(object, ambiguous);
224    },
225    
226    /**
227     * ----------------------------------------------------------------------------
228     *                OBJECTS
229     * ----------------------------------------------------------------------------
230     */
231    String: {
232        ucfirst: function(str) {
233            return str.substr(0,1).toUpperCase() + str.substr(1,str.length);
234        }
235    },
236    Wrapper: {
237        evalScripts: function(str) {
238            // prototype
239            if (typeof str.evalScripts == 'function') {
240                str.evalScripts();
241                return;
242            }
243            // pas prototype
244            var scripts, scriptsFinder=/<script[^>]*>([\s\S]+)<\/script>/gi;
245            while(scripts=scriptsFinder.exec(str)){
246               eval(scripts[1]);
247            }
248        },
249        /**
250         * Get an HTML element with its id
251         *
252         * @param string id obj the id of the HTML element
253         * @return HTMLelement
254         */
255        get : function (obj) {
256            return $(obj);
257        },
258        /**
259         * Observer for an element
260         */
261        observe : function (obj, evName, func, moz) {
262            Event.observe(obj, evName, func, moz);
263            return $(element);
264        },
265        /**
266         * Get an array of elements with CSS selector
267         *
268         * @param string selector the CSS selector
269         * @return array an array of HTML elements
270         */
271        getElementsByClassName : function (selector) {
272            return $$(selector);
273        },
274        /**
275         * Add a CSS classname to the HTML element
276         *
277         * @param string id obj the id of the HTML element
278         * @param string cls the CSS classname to add
279         * @return HTMLelement given
280         */
281        addClassName : function (obj, cls) {
282            $(obj).addClassName(cls);
283            return $(obj);
284        },
285        /**
286         * Remove a CSS classname to the HTML element
287         *
288         * @param string id obj the id of the HTML element
289         * @param string cls the CSS classname to remove
290         * @return HTMLelement given
291         */
292        removeClassName : function (obj, cls) {
293            $(obj).removeClassName(cls);
294            return $(obj);
295        },
296        /**
297         * In an event context, to be sure to get the right element (by css classname),
298         * even if it was one of its sub-element that triggered the event.
299         *
300         * @param event The triggered event
301         * @param classname The CSS classname that identifies the element to fetch
302         * @return HTMLelement
303         */
304        getElementWithClassNameInsideEvent: function(event, classname) {
305            var elem;
306            if (event.element().hasClassName(classname)) {
307                elem = event.element();
308            } else {
309                elem = event.element().up('.' + classname);
310            }
311
312            return elem;
313        }
314    },
315    Debug: {
316        /**
317         * Display an object. Clear content in container before display
318         *
319         * @param Object obj object to check
320         * @param string html element id in which to put object content
321         * @param boolean add true for adding content instead of clearing it
322         * @return void
323         */
324        show: function (obj, html, add) {
325            var str = '';
326            if (typeof obj == 'object') {
327                for (var i in obj) {
328                    str += i + ' : ' + obj[i] + '<br/><br/>';
329                }
330            } else {
331                str = obj;
332            }
333            if (!html) html = 'debug';
334            if (add) {
335                document.getElementById(html).innerHTML += str;
336            } else {
337                document.getElementById(html).innerHTML = str;
338            }
339        },
340        /**
341         * Display an object after the content which is already displayed
342         *
343         * @param Object obj object to check
344         * @param string html element id in which to put object content
345         * @return void
346         */
347        add: function (obj, html) {
348            this.show(obj, html, true);
349        }
350    },
351    Image: {
352        switchSrcOver: function(img) {
353            var src_img = img.getAttribute('src');
354            var arr_src_img = src_img.split('/');
355            var img_name = arr_src_img.pop();
356            if (img_name.include('_over.')) {
357                img_name = img_name.gsub('_over.', '.');
358            } else {
359                var arr_img_name = img_name.split('.');
360                var ext = arr_img_name.pop();
361                img_name = arr_img_name.join('.') + '_over.' + ext;
362            }
363            img.setAttribute('src', arr_src_img.join('/') + '/' + img_name);
364        }
365    },
366    Animation: {
367        _toastInfo: Imhotep.toast
368    }
369};
370
371if (typeof Ext != 'undefined') {
372
373
374
375if(Ext.form.NumberField){
376   Ext.apply(Ext.form.NumberField.prototype, {
377      // c'est le point le separateur chez les suisses
378      decimalSeparator : "."
379   });
380}
381
382Ext.onReady(function(){
383    ///
384    // Set des boutons de changement de langue
385    ///
386    var languages = Ext.query('.imhotep-language');
387    for (var i = 0; i < languages.length; i++) {
388        Ext.EventManager.on(languages[i], 'click', function() {
389            var id = this.id.split('_')[2];
390            window.location.href = window.location.href + '&lang=' + id;
391        }, languages[i]);
392    }
393});
394
395Ext.override(Ext.grid.ColumnModel, {
396    destroy : function() {
397        var length = this.config.length,
398            i = 0;
399
400        for (; i < length; i++){
401            // avec les imhotep documents, notamment, ca plante lors du destroy
402            // la dessus because destroy is not defined. Peut-etre les row
403            // et cell actions
404            if (typeof this.config[i].destroy != 'function') this.config[i].destroy = Ext.emptyFn;
405            this.config[i].destroy();
406        }
407        delete this.config;
408        delete this.lookup;
409        this.purgeListeners();
410    }
411});
412Ext.override(Ext.Element, {
413    contains : function(el){
414        try {
415            return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el);
416        } catch(e) {
417            return false;
418        }
419    }
420});
421Ext.override(Ext.grid.GridView, {
422    handleHdMenuClick : function(item){
423        var index = this.hdCtxIndex;
424        var cm = this.cm, ds = this.ds;
425        switch(item.itemId){
426            case "asc":
427                ds.sort(cm.getDataIndex(index), "ASC");
428                break;
429            case "desc":
430                ds.sort(cm.getDataIndex(index), "DESC");
431                break;
432            default:
433                index = item.itemId ? cm.getIndexById(item.itemId.substr(4)) : -1;
434                if(index != -1){
435                    if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){
436                        this.onDenyColumnHide();
437                        return false;
438                    }
439                    cm.setHidden(index, item.checked);
440                }
441        }
442        return true;
443    }
444});
445Ext.override(Ext.layout.MenuLayout, {
446    renderItem : function(c, position, target){
447        if (!this.itemTpl) {
448            this.itemTpl = Ext.layout.MenuLayout.prototype.itemTpl = new Ext.XTemplate(
449                '<li id="{itemId}" class="{itemCls}">',
450                    '<tpl if="needsIcon">',
451                        '<img src="{icon}" class="{iconCls}"/>',
452                    '</tpl>',
453                '</li>'
454            );
455        }
456        if(c && !c.rendered){
457            if(Ext.isNumber(position)){
458                position = target.dom.childNodes[position];
459            }
460            var a = this.getItemArgs(c);
461            c.render(c.positionEl = position ?
462                this.itemTpl.insertBefore(position, a, true) :
463                this.itemTpl.append(target, a, true));
464            c.positionEl.menuItemId = c.itemId || c.id;
465            if (!a.isMenuItem && a.needsIcon) {
466                c.positionEl.addClass('x-menu-list-item-indent');
467            }
468            this.configureItem(c, position);
469        }else if(c && !this.isValidParent(c, target)){
470            if(Ext.isNumber(position)){
471                position = target.dom.childNodes[position];
472            }
473            target.dom.insertBefore(c.getActionEl().dom, position || null);
474        }
475    },
476    getItemArgs: function(c) {
477        var isMenuItem = c instanceof Ext.menu.Item;
478        return {
479            isMenuItem: isMenuItem,
480            needsIcon: !isMenuItem && (c.icon || c.iconCls),
481            icon: c.icon || Ext.BLANK_IMAGE_URL,
482            iconCls: 'x-menu-item-icon ' + (c.iconCls || ''),
483            itemId: 'x-menu-el-' + c.id,
484            itemCls: 'x-menu-list-item' /*+ (this.extraCls || '')*/
485        };
486    }
487});
488Ext.override(Ext.layout.TableLayout, {
489    renderItem : function(c, position, target){
490        if(c && !c.rendered){
491            c.render(this.getNextCell(c));
492            /*if(this.extraCls){
493                var t = c.getPositionEl ? c.getPositionEl() : c;
494                t.addClass(this.extraCls);
495            }*/
496            this.configureItem(c, position);
497        }
498    }
499});/*
500Ext.override(Ext.layout.FormLayout, {
501    renderItem : function(c, position, target){
502        if(c && !c.rendered && (c.isFormField || c.fieldLabel) && c.inputType != 'hidden'){
503            var args = this.getTemplateArgs(c);
504            if(typeof position == 'number'){
505                position = target.dom.childNodes[position] || null;
506            }
507            if(position){
508                this.fieldTpl.insertBefore(position, args);
509            }else{
510                this.fieldTpl.append(target, args);
511            }
512            c.render('x-form-el-'+c.id);
513            this.configureItem(c, position);
514        }else {
515            Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
516        }
517    }
518});*/
519Ext.apply(Ext, {
520    in_array: function(arr, val) {
521        if (typeof arr == 'undefined' || arr.length == 0) return false;
522        for (var i = 0; i < arr.length; i++) {
523            if (arr[i] == val) return true;
524        }
525        return false;
526    },
527    applyAmbiguous: function(object, ambiguous) {
528        if (Ext.isArray(ambiguous)) {
529            ambiguous = {};
530        }
531
532        return Ext.apply(object, ambiguous);
533    }
534});
535Ext.override(Ext.data.Store, {
536    changeUrl: function(url) {
537        this.proxy.url = url;
538        this.proxy.conn.url = url;
539        this.proxy.setUrl(url, true);
540        for (var i in this.proxy.api) {
541            this.proxy.api[i].url = url;
542        }
543        return this;
544    }
545});
546
547Ext.override(Ext.grid.GridView, {
548    doRender : function(cs, rs, ds, startRow, colCount, stripe){
549        var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
550        var tstyle = 'width:'+this.getTotalWidth()+';';
551        // buffers
552        var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r;
553        var groupIndex = null, groupColumn = null;
554        if (typeof this.getGroupField == 'function') {
555            var groupField = this.getGroupField();
556            groupIndex = groupField ? this.cm.findColumnIndex(groupField) : null;
557            var groupId = groupIndex ? this.cm.getColumnId(groupIndex) : null;
558            groupColumn = groupId ? (this.cm.getColumnById(groupId) || {}) : {};
559        }
560        for(var j = 0, len = rs.length; j < len; j++){
561            r = rs[j]; cb = [];
562            var rowIndex = (j+startRow);
563            for(var i = 0; i < colCount; i++){
564                c = cs[i];
565                p.id = c.id;
566                p.css = i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
567                p.attr = p.cellAttr = '';
568                p.value = c.renderer.call(c.scope, r.data[c.name], p, r, rowIndex, i, ds);
569                p.style = c.style;
570                if(Ext.isEmpty(p.value)){
571                    p.value = ' ';
572                }
573                if(this.markDirty && r.dirty && Ext.isDefined(r.modified[c.name])){
574                    p.css += ' x-grid3-dirty-cell';
575                }
576                if (i === groupIndex && groupColumn.hideContentWhenGrouped) {
577                    p.css += ' x-grid3-cell-content-hide ';
578                }
579                cb[cb.length] = ct.apply(p);
580            }
581            var alt = [];
582            if(stripe && ((rowIndex+1) % 2 === 0)){
583                alt[0] = 'x-grid3-row-alt';
584            }
585            if(r.dirty){
586                alt[1] = ' x-grid3-dirty-row';
587            }
588            rp.cols = colCount;
589            if(this.getRowClass){
590                alt[2] = this.getRowClass(r, rowIndex, rp, ds);
591            }
592            rp.alt = alt.join(' ');
593            rp.cells = cb.join('');
594            buf[buf.length] =  rt.apply(rp);
595        }
596        return buf.join('');
597    }
598});
599Ext.lib.Ajax.isCrossDomain = function(u) {
600	var match = /(?:(\w*:)\/\/)?([\w\.]*(?::\d*)?)/.exec(u);
601	if (!match[1]) return false; // No protocol, not cross-domain
602	return (match[1] != location.protocol) || (match[2] != location.host);
603};
604
605Ext.override(Ext.data.Connection, {
606
607    remoteRequest : function(o){
608        if(this.fireEvent("beforerequest", this, o) !== false){
609            var p = o.params;
610
611            if(typeof p == "function"){
612                p = p.call(o.scope||window, o);
613            }
614            if(typeof p == "object"){
615                p = Ext.urlEncode(p);
616            }
617            if(this.extraParams){
618                var extras = Ext.urlEncode(this.extraParams);
619                p = p ? (p + '&' + extras) : extras;
620            }
621
622            var url = o.url || this.url;
623            if(typeof url == 'function'){
624                url = url.call(o.scope||window, o);
625            }
626
627            if(o.form){
628                var form = Ext.getDom(o.form);
629                url = url || form.action;
630
631                var enctype = form.getAttribute("enctype");
632                if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
633                    return this.doFormUpload(o, p, url);
634                }
635                var f = Ext.lib.Ajax.serializeForm(form);
636                p = p ? (p + '&' + f) : f;
637            }
638
639            var hs = o.headers;
640            if(this.defaultHeaders){
641                hs = Ext.apply(hs || {}, this.defaultHeaders);
642                if(!o.headers){
643                    o.headers = hs;
644                }
645            }
646
647            var cb = {
648                success: this.handleResponse,
649                failure: this.handleFailure,
650                scope: this,
651                argument: {options: o},
652                timeout : this.timeout
653            };
654
655            var method = o.method||this.method||(p ? "POST" : "GET");
656
657            if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
658                url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());
659            }
660
661            if(typeof o.autoAbort == 'boolean'){ // options gets top priority
662                if(o.autoAbort){
663                    this.abort();
664                }
665            }else if(this.autoAbort !== false){
666                this.abort();
667            }
668            if((method == 'GET' && p) || o.xmlData || o.jsonData){
669                url += (url.indexOf('?') != -1 ? '&' : '?') + p;
670                p = '';
671            }
672            if (o.scriptTag || this.scriptTag || Ext.lib.Ajax.isCrossDomain(url)) {
673               this.transId = this.scriptRequest(method, url, cb, p, o);
674            } else {
675               this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);
676            }
677            return this.transId;
678        }else{
679            Ext.callback(o.callback, o.scope, [o, null, null]);
680            return null;
681        }
682    },
683
684    scriptRequest : function(method, url, cb, data, options) {
685        var transId = ++Ext.data.ScriptTagProxy.TRANS_ID;
686        var trans = {
687            id : transId,
688            cb : options.callbackName || "stcCallback"+transId,
689            scriptId : "stcScript"+transId,
690            options : options
691        };
692
693        url += (url.indexOf("?") != -1 ? "&" : "?") + data + String.format("&{0}={1}", options.callbackParam || this.callbackParam || 'callback', trans.cb);
694
695        var conn = this;
696        window[trans.cb] = function(o){
697            conn.handleScriptResponse(o, trans);
698        };
699
700//      Set up the timeout handler
701        trans.timeoutId = this.handleScriptFailure.defer(cb.timeout, this, [trans]);
702
703        var script = document.createElement("script");
704        script.setAttribute("src", url);
705        script.setAttribute("type", "text/javascript");
706        script.setAttribute("id", trans.scriptId);
707        document.getElementsByTagName("head")[0].appendChild(script);
708
709        return trans;
710    },
711
712    handleScriptResponse : function(o, trans){
713        this.transId = false;
714        this.destroyScriptTrans(trans, true);
715        var options = trans.options;
716
717//      Attempt to parse a string parameter as XML.
718        var doc;
719        if (typeof o == 'string') {
720            if (window.ActiveXObject) {
721                doc = new ActiveXObject("Microsoft.XMLDOM");
722                doc.async = "false";
723                doc.loadXML(o);
724            } else {
725                doc = new DOMParser().parseFromString(o,"text/xml");
726            }
727        }
728
729//      Create the bogus XHR
730        response = {
731            responseObject: o,
732            responseText: (typeof o == "object") ? Ext.util.JSON.encode(o) : String(o),
733            responseXML: doc,
734            argument: options.argument
735        }
736        this.fireEvent("requestcomplete", this, response, options);
737        Ext.callback(options.success, options.scope, [response, options]);
738        Ext.callback(options.callback, options.scope, [options, true, response]);
739    },
740
741    handleScriptFailure: function(trans) {
742        this.transId = false;
743        this.destroyScriptTrans(trans, false);
744        var options = trans.options;
745        response = {
746            argument:  options.argument,
747            status: 500,
748            statusText: 'Server failed to respond',
749            responseText: ''
750        };
751        this.fireEvent("requestexception", this, response, options, {
752            status: -1,
753            statusText: 'communication failure'
754        });
755        Ext.callback(options.failure, options.scope, [response, options]);
756        Ext.callback(options.callback, options.scope, [options, false, response]);
757    },
758
759    // private
760    destroyScriptTrans : function(trans, isLoaded){
761        document.getElementsByTagName("head")[0].removeChild(document.getElementById(trans.scriptId));
762        clearTimeout(trans.timeoutId);
763        if(isLoaded){
764            window[trans.cb] = undefined;
765            try{
766                delete window[trans.cb];
767            }catch(e){}
768        }else{
769            // if hasn't been loaded, wait for load to remove it to prevent script error
770            window[trans.cb] = function(){
771                window[trans.cb] = undefined;
772                try{
773                    delete window[trans.cb];
774                }catch(e){}
775            };
776        }
777    }
778});
779
780
781/**
782 * Gere les vtype en combinaison avec le allowBlank
783 */
784Ext.apply(Ext.form.VTypes, {
785
786    emailblank: function(val) {
787        return val ? Ext.form.VTypes.email(val) : true;
788    },
789
790    emailblankText: Ext.form.VTypes.emailText,
791
792    emailblankMask: Ext.form.VTypes.emailMask,
793
794    datebefore: function(val, field) {
795        if (!val) return false;
796        var range = Ext.getCmp(field.rangeField);
797        if (!range || !range.getValue()) return true;
798
799        return field.getValue().getTime() <= range.getValue().getTime();
800    },
801    datebeforeText: 'Date trop recente',
802
803    dateafter: function(val, field) {
804        if (!val) return false;
805        var range = Ext.getCmp(field.rangeField);
806        if (!range || !range.getValue()) return true;
807
808        return field.getValue().getTime() >= range.getValue().getTime();
809    },
810    dateafterText: 'Date pas assez recente'
811});
812
813
814if (typeof Ext.ux != 'undefined' && typeof Ext.ux.grid != 'undefined' && typeof Ext.ux.grid.RowEditor != 'undefined') {
815    Ext.override(Ext.ux.grid.RowEditor, {
816        // ajout d'un if (f) pour eviter un bug si on a des colonnes hidden: true
817        startEditing: function(rowIndex, doFocus){
818            if(this.editing && this.isDirty()){
819                this.showTooltip(this.commitChangesText);
820                return;
821            }
822            if(Ext.isObject(rowIndex)){
823                rowIndex = this.grid.getStore().indexOf(rowIndex);
824            }
825            if(this.fireEvent('beforeedit', this, rowIndex) !== false){
826                this.editing = true;
827                var g = this.grid, view = g.getView(),
828                    row = view.getRow(rowIndex),
829                    record = g.store.getAt(rowIndex);
830
831                this.record = record;
832                this.rowIndex = rowIndex;
833                this.values = {};
834                if(!this.rendered){
835                    this.render(view.getEditorParent());
836                }
837                var w = Ext.fly(row).getWidth();
838                this.setSize(w);
839                if(!this.initialized){
840                    this.initFields();
841                }
842                var cm = g.getColumnModel(), fields = this.items.items, f, val;
843                for(var i = 0, len = cm.getColumnCount(); i < len; i++){
844                    val = this.preEditValue(record, cm.getDataIndex(i));
845                    f = fields[i];
846                    if (f) {
847                        f.setValue(val);
848                        this.values[f.id] = Ext.isEmpty(val) ? '' : val;
849                    }
850                }
851                this.verifyLayout(true);
852                if(!this.isVisible()){
853                    this.setPagePosition(Ext.fly(row).getXY());
854                } else{
855                    this.el.setXY(Ext.fly(row).getXY(), {duration:0.15});
856                }
857                if(!this.isVisible()){
858                    this.show().doLayout();
859                }
860                if(doFocus !== false){
861                    this.doFocus.defer(this.focusDelay, this);
862                }
863            }
864        }
865    });
866}
867
868
869if (typeof Ext.ux != 'undefined' && typeof Ext.ux.grid != 'undefined' && typeof Ext.ux.grid.RowActions != 'undefined') {
870
871    if (typeof Ext.ux.grid.RowActions.getEditor !== 'function') Ext.ux.grid.RowActions.prototype.getEditor = Ext.emptyFn;
872    if (typeof Ext.ux.grid.RowActions.destroy !== 'function') Ext.ux.grid.RowActions.prototype.destroy = Ext.emptyFn;
873
874    Ext.override(Ext.ux.grid.RowActions, {
875	tplRow:
876		 '<div class="ux-row-action">'
877		+'<tpl for="actions">'
878		+'<div class="ux-row-action-item {cls} <tpl if="text">'
879		+'ux-row-action-text</tpl>" style="{hide}{style}" ext:qtip="{qtip}">'
880                +'<tpl if="href"><a href="{href}" target="{target}">'
881                    +'<tpl if="text"><span ext:qtip="{qtip}">{text}</span></tpl>'
882                    +'<tpl if="!text">&nbsp;</tpl>'
883                +'</a></tpl>'
884                +'<tpl if="!href"><tpl if="text"><span ext:qtip="{qtip}">{text}</span></tpl></tpl>'
885		+'</div></tpl>'
886		+'</div>',
887
888        getData:function(value, cell, record, row, col, store) {
889            var opts = {};
890            var a, index, str;
891            for (var i in this.actions) {
892                a = this.actions[i];
893                if (a.href) {
894                    index = (a.iconIndex || a.iconCls) + 'href';
895                    if (typeof a.hrefFn == 'function') {
896                        opts[index] = a.scope ? a.hrefFn.call(a.scope, a, record, cell, row, col, store) : a.hrefFn(a, record, cell, row, col, store);
897                    } else if (a.hrefParams) {
898                        str = '';
899                        for (var j = 0; j < a.hrefParams.length; j++) {
900                            if (record.get(a.hrefParams[j])) {
901                                str += ', record.get(a.hrefParams[' + j + '])';
902                            } else {
903                                str += ', a.hrefParams[' + j + ']';
904                            }
905                        }
906                        opts[index] = eval('String.format(a.href' + str + ');');
907                    } else {
908                        opts[index] = a.href;
909                    }
910                }
911            }
912            return Ext.apply(record.data || {}, opts);
913	},
914
915        processActions:function(actions, template) {
916            var acts = [];
917
918            // actions loop
919            Ext.each(actions, function(a, i) {
920                    // save callback
921                    if(a.iconCls && 'function' === typeof (a.callback || a.cb)) {
922                            this.callbacks = this.callbacks || {};
923                            this.callbacks[a.iconCls] = a.callback || a.cb;
924                    }
925
926                    // data for intermediate template
927                    var o = {
928                             cls:a.iconIndex ? '{' + a.iconIndex + '}' : (a.iconCls ? a.iconCls : '')
929                            ,href: a.href ? '{' + (a.iconIndex || a.iconCls) + 'href}' : null
930                            ,target: a.target || '_self'
931                            ,qtip:a.qtipIndex ? '{' + a.qtipIndex + '}' : (a.tooltip || a.qtip ? a.tooltip || a.qtip : '')
932                            ,text:a.textIndex ? '{' + a.textIndex + '}' : (a.text ? a.text : '')
933                            ,hide:a.hideIndex
934                                    ? '<tpl if="' + a.hideIndex + '">'
935                                            + ('display' === this.hideMode ? 'display:none' :'visibility:hidden') + ';</tpl>'
936                                    : (a.hide ? ('display' === this.hideMode ? 'display:none' :'visibility:hidden;') : '')
937                            ,align:a.align || 'right'
938                            ,style:a.style ? a.style : ''
939                    };
940                    acts.push(o);
941
942            }, this); // eo actions loop
943
944            var xt = new Ext.XTemplate(template || this.tplRow);
945            return new Ext.XTemplate(xt.apply({actions:acts}));
946
947	}
948    });
949
950}
951
952Ext.data.Types.JSON = {
953    convert: function(v, data) {
954        try {
955            return eval(v)
956        } catch(e) {
957            Imhotep.Ajax.error(e);
958        }
959    },
960    sortType: function(v) {
961        return 1;
962    },
963    type: 'json'
964};
965
966
967
968Ext.ns('Et.form.Action');
969if (typeof Ext.form.Action.Submit != 'undefined') {
970    Ext.override(Ext.form.Action.Submit, {
971        handleResponse : function(response){
972            if(this.form.errorReader){
973                var rs = this.form.errorReader.read(response);
974                var errors = [];
975                if(rs.records){
976                    for(var i = 0, len = rs.records.length; i < len; i++) {
977                        var r = rs.records[i];
978                        errors[i] = r.data;
979                    }
980                }
981                if(errors.length < 1){
982                    errors = null;
983                }
984                return {
985                    success : rs.success,
986                    errors : errors
987                };
988            }
989            // ajout d'un try catch pour eviter des erreurs de js si la reponse est mal formee
990            try {
991                return Ext.decode(response.responseText);
992            } catch (e) {
993                var msg = response.responseText + '<br/>Javascript: ' + e.toString();
994                return {success: false, error: msg}
995            }
996        }
997    });
998}
999
1000}

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.