// Public web library Version 1.1 2009-04-28 - i-Seven// ----------------------------------------------------------// A short snippet for detecting versions of IE in JavaScript// without resorting to user-agent sniffing// ----------------------------------------------------------// If you're not in IE (or IE version is less than 5) then://     ie === undefined// If you're in IE (>=5) then you can determine which version://     ie === 7; // IE7// Thus, to detect IE://     if (ie) {}// And to detect the version://     ie === 6 // IE6//     ie > 7 // IE8, IE9 ...//     ie < 9 // Anything less than IE9// ---------------------------------------------------------- // UPDATE: Now using Live NodeList idea from @jdalton var ie = (function(){     var undef,        v = 3,        div = document.createElement('div'),        all = div.getElementsByTagName('i');     while (        div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',        all[0]    );     return v > 4 ? v : undef; }());if ( !ie < 9) {if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment){	Range.prototype.createContextualFragment = function(html)	{		var frag = document.createDocumentFragment(), 		div = document.createElement("div");		frag.appendChild(div);		div.outerHTML = html;		return frag;	};}}Ext.form.TwinTriggerField.override({    afterRender : function(){        Ext.form.TriggerField.superclass.afterRender.call(this);        var y;        if(Ext.isIE && !this.hideTrigger && this.el.getY() != (y = this.trigger.getY())){            this.el.position();            //this.el.setY(y);                    }    }});// ********************************* Ext.ns('Ext.ux.grid');Ext.apply(Ext.form.VTypes, {    'i7email': function(value){        var regExp = /^([\w\-]+)(\.[\w\-]+)*@([\w\-]+\.){1,5}([A-Za-z]){2,4}$/;        return regExp.test(value);    },    'i7emailText': 'This field must be a valid email address'});Ext.ux.grid.Search = function(config){    Ext.apply(this, config);    Ext.ux.grid.Search.superclass.constructor.call(this);};Ext.extend(Ext.ux.grid.Search, Ext.util.Observable, {    searchText: 'Search',    searchTypeText: 'Type',    searchTypeEmtyText: '<All Types>',    searchRadioText: 'Show all descendants',    searchTopDownloadText: 'Only Faq/Top',    searchTipText: 'Type a text to search and press Enter',    selectAllText: 'Select All',    position: 'top',    iconCls: 'icon-magnifier',    checkIndexes: 'all',    disableIndexes: [],    dateFormat: undefined,    showSelectAll: true,    mode: 'remote',    width: 200,    xtype: 'gridsearch',    paramNames: {        fields: 'fields',        query: 'query',        fd: 'fd',        deep: 'deep',        top: 'top'    },    shortcutKey: 'r',    shortcutModifier: 'alt',    init: function(grid){        this.grid = grid;                if ('string' === typeof this.toolbarContainer) {            this.toolbarContainer = Ext.getCmp(this.toolbarContainer);        }                grid.onRender = grid.onRender.createSequence(this.onRender, this);        grid.reconfigure = grid.reconfigure.createSequence(this.reconfigure, this);    },    onRender: function(){        var panel = this.toolbarContainer || this.grid;        var tb = 'bottom' === this.position ? panel.bottomToolbar : panel.topToolbar;                this.menu = new Ext.menu.Menu();        this.jsonReader = new Ext.data.JsonReader({            root: 'values',            totalProperty: 'valuecount',            id: 'id',            fields: [{                name: 'fdvalue'            }, {                name: 'fdalias'            }]        });        this.combodatastore = new Ext.data.Store({            proxy: new Ext.data.HttpProxy({                url: 'ag.i7.json?OpenAgent',                method: 'GET'            }),            baseParams: {                action: 'kw',                code: 'kwType',                lang: this.lang            },            reader: this.jsonReader,            autoLoad: true,            remoteSort: false        });        if ('right' === this.align) {            tb.addFill();        }        else {        }                this.field = new Ext.form.TwinTriggerField({            id: 'triggerfield',            width: this.width,            selectOnFocus: undefined === this.selectOnFocus ? true : this.selectOnFocus,            trigger1Class: 'x-form-clear-trigger',            trigger2Class: 'x-form-search-trigger',            onTrigger1Click: this.onTriggerClear.createDelegate(this),            onTrigger2Click: this.onTriggerSearch.createDelegate(this),            minLength: this.minLength        });                this.comboselect = new Ext.form.ComboBox({            id: "mycombo",            fieldLabel: this.searchTypeText,            store: this.combodatastore,            displayField: 'fdvalue',            valueField: 'fdalias',            emptyText: this.searchTypeEmtyText,            editable: false,            mode: 'local',            selectOnFocus: true,            triggerAction: 'all'                });                this.comboselect.on('select', function(){            this.field.onTrigger2Click();        }, this, {            single: false        });        this.topcheckbox = new Ext.form.Checkbox({            id: 'mytopcheckbox',            boxLabel: this.searchTopDownloadText,            checked: false        });        this.topcheckbox.on('check', function(){            this.field.onTrigger2Click();        }, this, {            single: false        });        this.field.on('render', function(){            this.field.el.dom.qtip = this.searchTipText;            var map = new Ext.KeyMap(this.field.el, [{                key: Ext.EventObject.ENTER,                scope: this,                fn: this.onTriggerSearch            }, {                key: Ext.EventObject.ESC,                scope: this,                fn: this.onTriggerClear            }]);            map.stopEvent = true;        }, this, {            single: true        });        tb.addSpacer();        tb.addSpacer();        tb.add(this.field);        tb.addSeparator();        tb.add({            text: this.searchTypeText        });        tb.add(this.comboselect);        tb.addSeparator();        tb.add(this.topcheckbox);		tb.add('->');		tb.add("<A href='(RssFeeds)/"+this.lang+"' target=_blank><IMG SRC=im.icon.rss.png></A>")		        this.reconfigure();        if (this.shortcutKey && this.shortcutModifier) {            var shortcutEl = this.grid.getEl();            var shortcutCfg = [{                key: this.shortcutKey,                scope: this,                stopEvent: true,                fn: function(){                    this.field.focus();                }            }];            shortcutCfg[0][this.shortcutModifier] = true;            this.keymap = new Ext.KeyMap(shortcutEl, shortcutCfg);        }    },    onTriggerClear: function(){        this.field.setValue('');        this.field.focus();        this.onTriggerSearch();    },    onTriggerSearch: function(){        if (!this.field.isValid()) {            return;        }        var store = this.grid.store;        var val = this.field.getValue();        var comboval = this.comboselect.getValue();        var topcheckboxval = this.topcheckbox.checked;        if ('local' === this.mode) {            store.clearFilter();            if (val) {                store.filterBy(function(r){                    var retval = false;                    this.menu.items.each(function(item){                        if (!item.checked || retval) {                            return;                        }                        var rv = r.get(item.dataIndex);                        rv = rv instanceof Date ? rv.format(this.dateFormat || r.fields.get(item.dataIndex).dateFormat) : rv;                        var re = new RegExp(val, 'gi');                        retval = re.test(rv);                    }, this);                    if (retval) {                        return true;                    }                    return retval;                }, this);            }            else {            }        }        else {            if (store.lastOptions && store.lastOptions.params) {                store.lastOptions.params[store.paramNames.start] = 0;            }            var fields = [];            this.menu.items.each(function(item){                if (item.checked) {                    fields.push(item.dataIndex);                }            });            delete (store.baseParams[this.paramNames.fields]);            delete (store.baseParams[this.paramNames.query]);            delete (store.baseParams[this.paramNames.fd]);            delete (store.baseParams[this.paramNames.top]);                        if (store.lastOptions && store.lastOptions.params) {                delete (store.lastOptions.params[this.paramNames.fields]);                delete (store.lastOptions.params[this.paramNames.query]);                delete (store.lastOptions.params[this.paramNames.fd]);                delete (store.lastOptions.params[this.paramNames.top]);            }            if (fields.length) {                store.baseParams[this.paramNames.query] = val;                store.baseParams[this.paramNames.fd] = comboval;                store.baseParams[this.paramNames.top] = topcheckboxval;            }            store.reload();        }            },    setDisabled: function(){        this.field.setDisabled.apply(this.field, arguments);    },    enable: function(){        this.setDisabled(false);    },    disable: function(){        this.setDisabled(true);    },    reconfigure: function(){            var menu = this.menu;        menu.removeAll();        if (this.showSelectAll) {            menu.add(new Ext.menu.CheckItem({                text: this.selectAllText,                checked: !(this.checkIndexes instanceof Array),                hideOnClick: false,                handler: function(item){                    var checked = !item.checked;                    item.parentMenu.items.each(function(i){                        if (item !== i && i.setChecked) {                            i.setChecked(checked);                        }                    });                }            }), '-');        }        var cm = this.grid.colModel;        Ext.each(cm.config, function(config){            var disable = false;            if (config.header && config.dataIndex) {                Ext.each(this.disableIndexes, function(item){                    disable = disable ? disable : item === config.dataIndex;                });                if (!disable) {                    menu.add(new Ext.menu.CheckItem({                        text: config.header,                        hideOnClick: false,                        checked: 'all' === this.checkIndexes,                        dataIndex: config.dataIndex                    }));                }            }        }, this);        if (this.checkIndexes instanceof Array) {            Ext.each(this.checkIndexes, function(di){                var item = menu.items.find(function(itm){                    return itm.dataIndex === di;                });                if (item) {                    item.setChecked(true, true);                }            }, this);        }    }});Ext.ns('i7');i7.NotifyForm = Ext.extend(Ext.form.FormPanel, {    border: false,    frame: true,    labelWidth: 80,    url: 'ag.i7.json.asServer',    unid: '',    lang: '',    brand: '',    initComponent: function(){            Ext.apply(this, {            defaultType: 'textfield',            defaults: {                anchor: '-24'            },            monitorValid: true //			,buttonAlign:'right'            ,            items: [{                name: 'yourname',                fieldLabel: 'Your name'            }, {                name: 'sender',                fieldLabel: 'Your e-mail',                allowBlank: false,                vtype: 'i7email'            }, {                name: 'email',                fieldLabel: 'Send to (e-Mail)',                allowBlank: false,                vtype: 'i7email'            }, {                name: 'note',                fieldLabel: 'Note',                xtype: 'textarea'            }],            buttons: [ //{            //	 text:'Load'            //	,scope:this            //	,handler:this.onLoadClick            //},            {                text: 'Send',                formBind: true,                scope: this,                handler: this.submit            }]        }); // eo apply        // call parent        i7.NotifyForm.superclass.initComponent.apply(this, arguments);            } // eo function initComponent    /**     * Form onRender override     */    ,    onRender: function(){            // call parent        i7.NotifyForm.superclass.onRender.apply(this, arguments);                // set wait message target        this.getForm().waitMsgTarget = this.getEl();            } // eo function onRender    /**     * Load button click handler     */    ,    onLoadClick: function(){        this.load({            url: this.url,            waitMsg: 'Loading...',            params: {                action: 'load',                unid: this.unid            }        });        // any additional load click processing here    } // eo function onLoadClick    ,    submit: function(){        this.getForm().submit({            url: this.url,            scope: this,            success: this.onSuccess,            failure: this.onFailure,            params: {                action: 'submitnotify',                unid: this.unid,                brand: this.brand,                lang: this.lang            },            waitMsg: 'Saving...'        });    } // eo function submit    ,    onSuccess: function(form, action){        Ext.Msg.show({            title: 'Success',            msg: 'Notify sent successfully',            modal: true,            icon: Ext.Msg.INFO,            buttons: Ext.Msg.OK        });        this.ownerCt.destroy(); // kill the parent container    } // eo function onSuccess    //	,onFailure:function(form, action) {    //		this.showError(action.result.error || action.response.responseText);    //	} // eo function onFailure        ,    showError: function(msg, title){        title = title || 'Error';        Ext.Msg.show({            title: title,            msg: msg,            modal: true,            icon: Ext.Msg.ERROR,            buttons: Ext.Msg.OK        });    } // eo function showError}); // eo extendExt.reg('i7notifyform', i7.NotifyForm);i7.PromptDownload = Ext.extend(Ext.form.FormPanel, {    border: false,    frame: true,    labelWidth: 80,    url: 'http://ds1s.mlm.elc.beijer.se/web/webformhandler.nsf/agfilelink?openagent',    unid: '',    lang: '',    brand: '',    Labels: '',    test: 'test',    initComponent: function(){        Ext.apply(this, {            defaultType: 'textfield',            defaults: {                anchor: '-24'            },            monitorValid: true //			,buttonAlign:'right'            ,            items: [{                name: 'fldWebUserName',                fieldLabel: this.Labels[0].PROMPTLABEL1,                allowBlank: false            }, {                name: 'fldWebUserCompanyName',                fieldLabel: this.Labels[0].PROMPTLABEL2,                allowBlank: false            }, {                name: 'fldWebUserCity|',                fieldLabel: this.Labels[0].PROMPTLABEL3,                allowBlank: false            }, {                name: 'fldWebUserPhone',                fieldLabel: this.Labels[0].PROMPTLABEL4,                allowBlank: false            }, {                name: 'fldWebUserEmail',                fieldLabel: this.Labels[0].PROMPTLABEL5,                allowBlank: false,                vtype: 'i7email'            }, {                name: 'fldRswTemplate',                labelSeparator: '',                itemCls: 'invisible',                hidden: true,                labelStyle: 'display:none',                style: 'display:none'                        }, {                name: 'fldRswJson',                labelSeparator: '',                itemCls: 'invisible',                hidden: true,                labelStyle: 'display:none',                style: 'display:none'            }, {                name: 'fldRswMailList',                labelSeparator: '',                itemCls: 'invisible',                hidden: true,                labelStyle: 'display:none',                style: 'display:none'            }, {                name: 'fldRswMS',                labelSeparator: '',                itemCls: 'invisible',                hidden: true,                labelStyle: 'display:none',                style: 'display:none'            }, {                name: 'fldLinkBody',                labelSeparator: '',                itemCls: 'invisible',                hidden: true,                labelStyle: 'display:none',                style: 'display:none'            }, {                name: 'fldLinkSender',                labelSeparator: '',                itemCls: 'invisible',                hidden: true,                labelStyle: 'display:none',                style: 'display:none'            }, {                name: 'fldLinkSubject',                labelSeparator: '',                itemCls: 'invisible',                hidden: true,                labelStyle: 'display:none',                style: 'display:none'            }, {                name: 'fldRswPrefix',                labelSeparator: '',                itemCls: 'invisible',                hidden: true,                labelStyle: 'display:none',                style: 'display:none',                value: window.location.hostname            }],            buttons: [ //{            ///	 text:'Load'            //	,scope:this            //	,handler:this.onLoadClick            //},            {                text: this.Labels[0].PROMPTBUTTONTEXT,                formBind: true,                scope: this,                handler: this.submit            }]        });                i7.PromptDownload.superclass.initComponent.apply(this, arguments);    },    onRender: function(){            i7.PromptDownload.superclass.onRender.apply(this, arguments);        this.getForm().waitMsgTarget = this.getEl();        this.getForm().load({            url: 'ag.i7.json?Openagent',            params: {                action: 'LOADPROMPTDOWNLOADFORM',                i18n: '',                unid: this.unid,                lang: this.lang,                brand: this.brand,                waitMsg: 'Loading'            }        });            },    onLoadClick: function(){        this.load({            url: this.url,            waitMsg: 'Loading...',            params: {                action: 'load',                unid: this.unid            }        });    },    submit: function(){        this.getForm().submit({            url: '/web/webformhandler.nsf/agfilelink?openagent',            scope: this,            success: this.onSuccess,            failure: this.onFailure,            params: {                action: 'submitnotify',                unid: this.unid,                brand: this.brand,                lang: this.lang,                test: this.test            },            waitMsg: 'Saving...'        });    },    onSuccess: function(form, action){        Ext.Msg.show({            title: 'Success',            msg: 'Links sent successfully',            modal: true,            icon: Ext.Msg.INFO,            buttons: Ext.Msg.OK        });        this.ownerCt.destroy(); // kill the parent container    } //	,onFailure:function(form, action) {    //		this.showError(action.result.error || action.response.responseText);    //	}         ,    showError: function(msg, title){        title = title || 'Error';        Ext.Msg.show({            title: title,            msg: msg,            modal: true,            icon: Ext.Msg.ERROR,            buttons: Ext.Msg.OK        });    }});Ext.reg('promptdownload', i7.PromptDownload);function renderStatusIcon(value, p, record){    if (value === '') {        return;    }    return String.format('<IMG SRC="im.icon{0}.gif">', value);}FileLibraryUI = function(config){    //var sess = Ext.nd.Session; // should we assume that there will always be a session?    //var db = sess.currentDatabase;    //this.dbPath = db.webFilePath;        this.displayFunctions = ['NOFUNCTIONS'];    this.displayLanguage = 'EN';    this.displayBrand = '';    this.UImargins = '5 10 30 10';    this.OutlineMargins = '5 5 0 0';    this.GridMargins = '5 0 0 0';    this.customKey = '';    this.DocID = '';    this.addedcolumns = [];    this.addedfields = [];    this.simpleUI = false;    this.IsEditor = false;    this.Expand = ""    this.showAsPanel = false    this.securityCode = ''    this.refreshTabTitle = true        //this.Header = {viewName: '', viewUrl: ''};    //this.Browser = {outlineName: '', outlineUrl: ''};    this.grid = {        securityfunctions: ''        };    this.StandardGridFields = ['unid', 'fdicon', 'fddescription', 'icons', 'fdtype', {        name: 'fddate',        type: 'date',        dateFormat: 'Y-m-d'    }]            Ext.apply(this, config); // Applies th stuff we configed the UI with in the form     this.init();        if (!this.autoOpen == '') {        //	this.showInPanel('autoopen' ,'autoopen', this.dbPath + '/fm.BE.BexFilePile.Wizard?openform&pdData_fdWebCompose=clWizard&SupportID=' + this.supportid)    }        if (!this.customKey == '') {        this.openKey()    }        if (!this.securityCode == '') {        this.securityKeySearch()    }        }FileLibraryUI.prototype = {    init: function(){                this.createFileLibraryUI();                this.tb = new Ext.Toolbar({            border: false        });                this.colModel = [ //{header: this.Labels[0].COLUMNNAME_TYPE, width: 150, hidden:true, sortable:true,resizable: false, dataIndex: 'fdtype', type:'string'},        	        {            header: '',            width: 150,            hidden: true,            sortable: true,            resizable: false,            dataIndex: 'fdtype',            type: 'string'        }, {            header: " ",            width: 26,            fixed: true,            sortable: false,            renderer: this.renderIcon,            resizable: false,            dataIndex: 'fdicon'        }, {            header: this.Labels[0].COLUMNNAME_DESCRIPTION,            width: 500,            sortable: true,            renderer: this.renderToggle,            dataIndex: 'fddescription'        }, {            header: this.Labels[0].COLUMNNAME_UPDATED,            width: 90,            sortable: true,            type: 'date',            dataIndex: 'fddate',            renderer: Ext.util.Format.dateRenderer('Y-m-d')        }]                                                                this.Header = new Ext.Panel(Ext.apply({            viewport: this.viewport,            border: false,            container: this.HeaderPanel,            items: [this.tb]        }, this.Header));                this.jsonReader = new Ext.data.JsonReader({            root: 'root',            totalProperty: 'recordcount',            id: 'id',            fields: this.StandardGridFields.concat(this.addedfields)        });                        this.GroupedDataStore = new Ext.data.GroupingStore(Ext.apply({            proxy: new Ext.data.HttpProxy({                url: 'ag.i7.json?OpenAgent',                method: 'GET'            }),            reader: this.jsonReader,            remoteSort: false,            sortInfo: {                field: 'fddescription',                direction: 'ASC'            },            groupField: 'fdtype',                        baseParams: {                action: 'NodeQuery',                df: this.displayFunctions.join(','),                lang: this.displayLanguage,                b: this.displayBrand,                exp: this.Expand            }        }, this.GroupedDataStore));                // Handle expand/collapse on store load                        this.colModel = new Ext.grid.ColumnModel(this.colModel.concat(this.addedcolumns));                                       if (!this.simpleUI) {        	            this.gridplugins = new Ext.ux.grid.Search({                mode: 'remote',                iconCls: false,                dateFormat: 'm/d/Y',                minLength: 2,                Labels: this.Labels,                lang: this.displayLanguage,                searchText: this.Labels[0].LABEL9,                searchTypeText: this.Labels[0].COLUMNNAME_TYPE,                searchTypeEmtyText: this.Labels[0].ALLTYPES,                searchRadioText: this.Labels[0].SHOWDESCENDANTS,                searchTopDownloadText: this.Labels[0].SHOWONLYTOPDOWNLOADS            })                    }        else {                    this.gridplugins = new Ext.ux.grid.DialogSearch({                mode: 'remote',                iconCls: false,                dateFormat: 'm/d/Y',                minLength: 2            })                    }                                                        this.gv = new Ext.grid.GroupingView({            forceFit: true,            startCollapsed: true,            enableRowBody: false,            groupTextTpl: '{text} ({[values.rs.length]}{[values.rs.length > 1 ? "": ""]})'        })                this.grid = new Ext.grid.GridPanel(Ext.apply({            id: 'mygridpanel',            region: 'center',            border: !this.showAsPanel,            margins: this.GridMargins,            store: this.GroupedDataStore,            cm: this.colModel,            sm: new Ext.grid.RowSelectionModel({                singleSelect: false            }),            iconCls: 'icon-grid',            loadMask: true,            tbar: [],            plugins: [this.gridplugins],            view: this.gv                }, this.grid));                                this.treeloader = new Ext.tree.TreeLoader()                        this.treeloader.dataUrl = '(statictreesJSON)/' + this.displayLanguage + '$$' + this.displayBrand        this.grid.on('rowclick', this.openCustomerDoc, this);                this.godeepcheckbox = new Ext.form.Checkbox({            id: 'mygodeepcheckbox',            boxLabel: this.Labels[0].SHOWDESCENDANTS,            checked: false        })                this.checkboxBox = new Ext.Panel({            hidden: true,            style: 'margin:10px;',            bodyStyle: 'padding-left:10px',            height: 50,            width: 200,            border: true,            items: [this.godeepcheckbox]        })                        this.mytree = new Ext.tree.TreePanel({            border: false,            animate: true,            layout: 'fit',            autoScroll: false,            enableDD: false,            containerScroll: true,            rootVisible: false,            loader: this.treeloader                });                this.outline = new Ext.Panel({            split: true,            margins: this.OutlineMargins,            region: 'west',            width: 250,            autoScroll: true,            layout: 'column',            items: [this.mytree, this.checkboxBox]        })                this.godeepcheckbox.on('check', function(){            this.goDeep(this.triggersearch)            this.triggersearch = true        }, this, {            single: false        })                this.mytree.on('click', this.openEntry, this);                        this.root = new Ext.tree.AsyncTreeNode({            text: '[Root]',            border: false,            draggable: false,            expandable: true,            leaf: false,            id: 'source'        });                this.mytree.setRootNode(this.root);                        /*         this.Browser = new Ext.Panel(Ext.apply({         container: this.BrowsePanel,         viewport: this.viewport,         id: 'winid',         layout: 'border',         border: false,         items: [this.grid, this.outline]         }, this.Browser));                  */        if (!this.simpleUI) {            this.Browser = new Ext.Panel(Ext.apply({                container: this.BrowsePanel,                viewport: this.viewport,                id: 'winid',                layout: 'border',                border: false,                items: [this.grid, this.outline]            }, this.Browser));        }        else {            this.Browser = new Ext.Panel(Ext.apply({                container: this.BrowsePanel,                viewport: this.viewport,                id: 'winid',                layout: 'border',                border: false,                items: [this.grid]            }, this.Browser));        }                this.BrowsePanel.setTitle(Ext.util.Format.ellipsis(this.Labels[0].TABTITLE, 40));        this.BrowsePanel.add(this.Browser)        this.BrowsePanel.doLayout()                                this.grid.getStore().sort({            fieldName: 'fdtype',            dir: 'ASC'        });                this.tabPanel.doLayout()        Ext.QuickTips.init();        		 if (this.simpleUI) {            var gridHead = this.grid.getGridEl().child('div[class=x-grid3-header]');            gridHead.setStyle('display', 'none');        }		        //this.treeToolbar.addSeparator()        //this.treeToolbar.add(this.godeepcheckbox)                                        if (!this.DocID == '') {            this.openDocID(this.DocID)        }                    },        renderToggle: function(value, p, record){        sEncode = Ext.util.Format.htmlEncode(value);        return String.format('{0}{1}', sEncode, record.data.icons);    },    renderIcon: function(value, p, record){        return String.format('<IMG SRC="{0}">', value, record.data.unid);    },    renderStatusIcon: function(value, p, record){        return String.format('<IMG SRC="im.icon{0}.gif">', value);    },    openKey: function(){            this.GroupedDataStore.proxy = new Ext.data.HttpProxy({            url: 'ag.i7.json?OpenAgent',            method: 'GET'        })        this.GroupedDataStore.baseParams = {            key: this.customKey,            df: this.displayFunctions.join(','),            lang: this.displayLanguage,            b: this.displayBrand,            exp: this.Expand                }        this.GroupedDataStore.groupField = 'fdtype'        this.GroupedDataStore.on({            'load': {                fn: this.checkGrouping,                scope: this            }        });        this.GroupedDataStore.load()            },    securityKeySearch: function(){            this.GroupedDataStore.proxy = new Ext.data.HttpProxy({            url: 'ag.i7.json?OpenAgent',            method: 'GET'        })        this.GroupedDataStore.baseParams = {            action: 'codesearch',            key: this.securityCode,            lang: this.displayLanguage,            b: this.displayBrand                }        this.GroupedDataStore.groupField = 'fdtype'        this.GroupedDataStore.load()        this.BrowsePanel.setTitle(Ext.util.Format.ellipsis(this.Labels[0].SEARCHLISTTITLE, 40));    },    checkGrouping: function(){        if (this.jsonReader.jsonData.grouped == '1') {            this.GroupedDataStore.groupField = "fdtype"                        this.grid.getView().refresh()            if (!this.jsonReader.jsonData.expand == '') {                var gid = this.gv.getGroupId(this.jsonReader.jsonData.expand);                if (Ext.get(gid)) {                    if (gid) {                        this.gv.toggleGroup(gid, true)                    };                                    }            }                    }        else {                    this.GroupedDataStore.groupField = "fdtype"            this.grid.getView().refresh()        }        if (this.simpleUI) {            //this.BrowsePanel.setTitle(Ext.util.Format.ellipsis(this.jsonReader.jsonData.tabtitle,16));            this.BrowsePanel.setTitle(Ext.util.Format.ellipsis(this.Labels[0].SEARCHLISTTITLE, 40));                    }            },    goDeep: function(triggersearch){        if (triggersearch) {            this.GroupedDataStore.baseParams['deep'] = this.godeepcheckbox.checked            FileLibrary.ui.gridplugins.onTriggerSearch()        }    },    openEntry: function(node, e){        node.toggle();        if (node.isExpandable()) {            this.checkboxBox.setVisible(true)            this.triggersearch = false            this.godeepcheckbox.setValue(false)            this.triggersearch = true        }        else {            this.checkboxBox.setVisible(false)            this.triggersearch = false            this.godeepcheckbox.setValue(false)            this.triggersearch = true        }                        this.GroupedDataStore.proxy = new Ext.data.HttpProxy({            url: 'ag.i7.json?OpenAgent',            method: 'GET'        })        this.GroupedDataStore.baseParams = {            action: 'NodeQuery',            code: node.attributes.code,            tree: node.attributes.tree,            category: node.attributes.category,            level: node.attributes.level,            df: this.displayFunctions.join(','),            lang: this.displayLanguage,            b: this.displayBrand,            exp: this.Expand        };                var combo = Ext.getCmp('mycombo');        var godeepcheckbox = Ext.getCmp('mygodeepcheckbox');                var triggerfield = Ext.getCmp('triggerfield')        triggerfield.fireEvent("onTrigger2Click")        FileLibrary.ui.gridplugins.onTriggerSearch()        var mygrid = Ext.getCmp('mygridpanel');        mygrid.setTitle(Ext.util.Format.ellipsis(node.attributes.category, 16));            },    ReloadGrid: function(){        this.grid.getStore().reload()            },    openDocID: function(unid){        var entry = this.tabPanel.getItem('pnl-' + unid);        if (!entry) {            currentdocument = new CustomerDocUI({                title: 'Opening..',                unid: unid,                Labels: this.Labels,                Lang: this.displayLanguage,                Brand: this.displayBrand,                Functions: this.displayFunctions,                container: this.tabPanel,                securityCode: this.securityCode                        })        }        else {            entry.show()        }            },    openCustomerDoc: function(grid, row, e){        var record = grid.getStore().getAt(row);        var entry = this.tabPanel.getItem('pnl-' + record.data.unid);        if (!entry) {            var record = grid.getStore().getAt(row);            currentdocument = new CustomerDocUI({                title: record.data.fddescription,                unid: record.data.unid,                Lang: this.displayLanguage,                Brand: this.displayBrand,                Functions: this.displayFunctions,                container: this.tabPanel,                Labels: this.Labels,                securityCode: this.securityCode            })        }        else {            entry.show()                                }                    },        shownotify: function(){        Ext.form.Field.prototype.msgTarget = 'side';                var win = new Ext.Window({            id: 'formloadsubmit-win',            title: 'Send a link to a friend',            layout: 'fit',            width: 350,            height: 240,            closable: true,            border: false,            modal: true //,items:{id:'formloadsubmit-form', xtype:'i7notifyform'}            ,            items: [new i7.NotifyForm({                id: 'notify-form',                unid: btn.unid,                lang: this.displayLanguage            })]        });                win.show();            },            createFileLibraryUI: function(){        if (this.showAsPanel) {            this.viewport = new Ext.Viewport({                layout: 'border',                id: 'filelibrary-viewport',                items: [new Ext.TabPanel({                    hideBorders: false,                    id: 'filelibrary-center-panel',                    region: 'center',                    enableTabScroll: true,                    activeTab: 0,                    height: 800,                    margins: this.UImargins,                    border: false,                    items: [{                        xtype: 'panel',                        id: 'filelibrary-browse-panel',                        border: false,                        iconCls: 'foldericon',                        layout: 'fit'                    }]                })]            });                                }        else {            this.viewport = new Ext.Viewport({                layout: 'border',                id: 'filelibrary-viewport',                items: [{                    xtype: 'tabpanel',                    region: 'center',                    hideBorders: false,                    id: 'filelibrary-center-panel',                    enableTabScroll: true,                    activeTab: 0,                    split: true,                    margins: this.UImargins,                    border: false,                    items: [{                        xtype: 'panel',                        id: 'filelibrary-browse-panel',                        border: false,                        iconCls: 'foldericon',                        layout: 'fit'                    }]                }, {                    xtype: 'panel',                    region: 'south'                }]            });                                }                                this.HeaderPanel = Ext.getCmp('filelibrary-header-panel');        this.BrowsePanel = Ext.getCmp('filelibrary-browse-panel');        this.tabPanel = Ext.getCmp('filelibrary-center-panel');        this.tabPanel.on('beforeremove', this.fixIFrame, this);    },        // This is a hack to fix the memory issues that occur when opening and closing stuff within iFrames    fixIFrame: function(container, panel){        var iFrame = panel.getEl().dom;        if (iFrame.src) {            iFrame.src = "javascript:false";        }        Ext.removeNode(iFrame);    },        showError: function(){        alert("An error has occured");    }};CustomerDocUI = function(config){    this.unid = '';    this.Lang = '';    this.Brand = '';    this.PromptDownload = '0';    this.Labels = '';    this.PrintLayout = ''    this.WindowLayout = ''    this.agentpath = ''    this.securityCode = ''    Ext.apply(this, config); // Applies th stuff we configed the UI with in the form     this.init();    }CustomerDocUI.prototype = {    init: function(){            this.createCustomerDocUI();                this.PromptDownloadButton = new Ext.Button({            text: this.Labels[0].PROMPTBUTTONTEXT,            style: 'margin-top:20px',            scope: this,            iconCls: 'notifysendicon',            handler: function(){                Ext.form.Field.prototype.msgTarget = 'side';                var win = new Ext.Window({                    id: 'formloadsubmit-win',                    title: '',                    layout: 'fit',                    width: 350 //	,height:240                    ,                    closable: true,                    border: false,                    modal: true,                    items: [new i7.PromptDownload({                        height: 210,                        id: 'notify-form',                        unid: this.unid,                        lang: this.Lang,                        Labels: this.Labels                                        })]                });                win.show();            }        });                        this.PromptDownload = new Ext.Panel({            border: false,            bodyStyle: 'margin-top:20px',            items: [{                html: '<Table cellspacing="0" cellpadding="0" border="0" ><TR><TD><B>' + this.Labels[0].DOWNLOAD + '</B></TD><TD></TD></TR></Table>',                border: false,                bodyStyle: 'margin-top:5px'            }, {                html: this.Labels[0].PROMPTPREFACE,                border: false,                bodyStyle: 'margin-top:5px'            }, this.PromptDownloadButton]        })                        this.FileReader = new Ext.data.JsonReader({            totalProperty: 'totalcount',            root: 'root',            fields: [{                name: 'fileicon'            }, {                name: 'filename'            }, {                name: 'filesize'            }, {                name: 'fileurl'            }, {                name: 'wtgroup'            }, {                name: 'wtdesc'            }]        });                        this.FileDataStore = new Ext.data.Store({            proxy: new Ext.data.HttpProxy({                url: this.agentpath + 'ag.i7.json?OpenAgent',                method: 'GET'            }),            baseParams: {                action: 'JSONDETAILS',                code: this.unid,                lang: this.Lang,                b: this.Brand,                df: this.Functions.join(','),                sc: this.securityCode            },            reader: this.FileReader,            autoLoad: true,            remoteSort: false        });                this.FileDataStore.on('load', function(){            if (this.FileReader.jsonData.prompt == '1') {                this.FileDataView.hide()                Ext.getCmp('download' + this.unid).add(this.PromptDownload)                this.outline.doLayout()                this.FileDataView.getEl().on('click', function(e, t){                    e.stopEvent();                    alert('no way')                }, this, {                    delegate: 'a.downloadlinkclass'                });                            }                        if (this.FileReader.jsonData.translatedtext == 'VIOLATION') {                var s = "<a href='" + window.location.href + "&Login' target='_self'>Click here to login</a>"                Ext.getCmp('descbody' + this.unid).body.update('You are trying to access a document you dont have access to<BR>' + s)                                                myMask.hide()                            }            else {                Ext.getCmp('descbody' + this.unid).body.update(this.FileReader.jsonData.translatedtext);                                Ext.getCmp('subjectbody' + this.unid).body.update(Ext.util.Format.htmlEncode(this.FileReader.jsonData.subject));                Ext.getCmp('summarybody' + this.unid).body.update(this.FileReader.jsonData.summary);                                if (this.container) {                    Ext.getCmp('prevnext' + this.unid).body.update(this.FileReader.jsonData.prevnext);                    this.LinkDataStore.load()                    this.documentlayout.setTitle(Ext.util.Format.ellipsis(this.FileReader.jsonData.subject, 16))                    myMask.hide()                                                        }            }                                }, this);                        this.FileTemplate = new Ext.XTemplate('<div class="props-view">', '<B>' + this.Labels[0].DOWNLOAD + '</B>', '<table class="downloadlinktable" cellspacing="0" cellpadding="0" border="0" style="margin-top:5px;margin-bottom:25px">', '<tpl for=".">', '<tr class="{[xindex % 2 === 0 ? "odd" : "odd"]}">', '<td width=20><IMG src="{fileicon}"></td>', '<td><div class="props-row"><a href="{fileurl}" onMouseDown="dcsMultiTrack(\'WT.cg_n\',\'{wtgroup}\',\'WT.cg_s\',\'{wtdesc}\',\'WT.ti\',\'{wtdesc}\',\'DCS.dcsuri\',\'{fileurl}.html\')"; qtip="{[this.tip(values["filename"], values["filesize"])]}" target= "_blank" class="downloadlinkclass" >{[Ext.util.Format.ellipsis(values["filename"],35)]}</a></div></td>', '</tr>', '</tpl>', '</table>', '</div>', '<div class="x-clear"></div>', {            tip: function(n, s){                return '<B>File information</B>' + '<BR>file name: ' + n + '<BR>file size: ' + s            }        });                this.LinkTemplate = new Ext.XTemplate('<div class="props-view">', '<B>' + this.Labels[0].RELATEDLINKS + '</B>', '<table cellspacing="0" cellpadding="0" border="0">', '<tpl for=".">', '<tr class="{[xindex % 2 === 0 ? "odd" : "odd"]}">', '<td><div class="props-row" style="margin-bottom:5px">{linkname}<BR><a href="#" class="linkclass" id="{linkunid}" linkname="{linkname}" target="_blank">' + this.Labels[0].READMORE + '</a></div></td>', '</tr>', '</tpl>', '</table>', '</div>', '<div class="x-clear"></div>');                this.LinkReader = new Ext.data.JsonReader({            root: 'root',            totalProperty: 'recordcount',            fields: [{                name: "linkname",                mapping: "linkname"            }, {                name: "linkid",                mapping: "linkid"            }, {                name: "linkunid",                mapping: "linkunid"            }]        });                this.LinkDataStore = new Ext.data.Store({            reader: this.LinkReader,            proxy: new Ext.data.HttpProxy({                url: this.agentpath + 'ag.i7.json?OpenAgent',                method: 'GET'            }),            baseParams: {                action: 'GETLINKS',                code: this.unid,                lang: this.Lang,                b: this.Brand,                df: this.Functions.join(','),                sc: this.securityCode            },            remoteSort: false,            autoLoad: false        })                this.LinkDataView = new Ext.DataView({ // Links            id: 'linkholder-' + this.unid,            store: this.LinkDataStore,            tpl: this.LinkTemplate,            multiSelect: false,            overClass: 'x-view-over',            itemSelector: 'div.props-row',            emptyText: '',            style: 'margin-top:15px',            border: false,            listeners: {                'afterlayout': {                    fn: function(p){                        p.disable();                    },                    single: true // important, as many layouts can occur                }            }        })                if (this.WindowLayout == '1') {            this.FileDataView = new Ext.Panel()        }        else {            this.FileDataView = new Ext.DataView({ // Files and attachments                id: 'fileholder-' + this.unid,                store: this.FileDataStore,                tpl: this.FileTemplate,                multiSelect: false,                overClass: 'x-view-over',                itemSelector: 'div.props-row',                emptyText: '',                style: 'margin-top:15px',                border: false            })        }                        this.outline = new Ext.Panel({            bodyStyle: 'padding:10px',            border: false,            items: [{                id: 'prevnext' + this.unid,                border: false            }, {                id: 'summarybody' + this.unid,                border: false            }, {                id: 'download' + this.unid,                border: false            }, this.FileDataView, this.LinkDataView]                })                this.centercontent = new Ext.Panel({ // Body            bodyStyle: 'padding:15px',            //region:'center',            border: false,            autoScroll: true,            items: [{                id: 'subjectbody' + this.unid,                border: false,                bodyStyle: 'margin-top:12px;margin-bottom:5px;font-weight:bold;font-size:14px'            }, {                cls: 'mcereader',                id: 'descbody' + this.unid,                border: false            }]        })                Ext.QuickTips.init();        this.OutlinePanel.add(this.outline)        this.OutlinePanel.doLayout()                this.CenterPanel.add(this.centercontent)        this.CenterPanel.doLayout()                if (this.container) { // Open in Tabbed interface            this.container.add(this.documentlayout).show()            var myMask = new Ext.LoadMask(Ext.getCmp('pnl-' + this.unid).body, {                msg: "Please wait...loading description and files"            });            myMask.show()        }        else { // Render as viewport        }        this.documentlayout.doLayout()                        // Add listener for clicks on links dataview        this.LinkDataView.getEl().on('click', function(e, t){            e.stopEvent();            this.OpenLink(e, t)        }, this, {            delegate: 'a.linkclass'        });                            },    OpenLink: function(e, t){        var entry = this.container.getItem('pnl-' + t.id);        if (!entry) {                    new CustomerDocUI({                title: 'Opening..',                unid: t.id,                Lang: this.Lang,                Brand: this.Brand,                Functions: this.Functions,                container: this.container,                Labels: this.Labels            })        }        else {            entry.show()        }            },    createCustomerDocUI: function(){        if (this.WindowLayout == "1") {            this.documentlayout = new Ext.Window({                id: 'pnl-' + this.unid,                width: 800,                height: 400,                modal: true,                border: true,                layout: 'border',                items: [{                    xtype: 'panel',                    region: 'center',                    id: 'doc-center-panel' + this.unid,                    layout: 'fit',                    border: false                }, {                    xtype: 'panel',                    id: 'doc-west-panel' + this.unid,                    region: 'north',                    height: 90,                    border: false                }]            });                        this.OutlinePanel = Ext.getCmp('doc-west-panel' + this.unid);            this.CenterPanel = Ext.getCmp('doc-center-panel' + this.unid);            this.documentlayout.show()                    }        else             if (this.PrintLayout == "1") {                this.documentlayout = new Ext.Viewport({                    id: 'pnl-' + this.unid,                    border: true,                    layout: 'border',                    items: [{                        xtype: 'panel',                        region: 'center',                        id: 'doc-center-panel' + this.unid,                        layout: 'fit',                        border: false                    }, {                        xtype: 'panel',                        id: 'doc-west-panel' + this.unid,                        region: 'north',                        height: 250,                        border: false                    }]                });                                this.OutlinePanel = Ext.getCmp('doc-west-panel' + this.unid);                this.CenterPanel = Ext.getCmp('doc-center-panel' + this.unid);                                            }            else                 if (this.container) { // Opened in a tabbed interface                    this.documentlayout = new Ext.Panel({                        id: 'pnl-' + this.unid,                        closable: true,                        title: Ext.util.Format.ellipsis(this.title, 24),                        border: true,                        layout: 'border',                        items: [{                            xtype: 'panel',                            region: 'center',                            id: 'doc-center-panel' + this.unid,                            layout: 'fit',                            border: false,                            bodyStyle: 'border-left:1px solid #c7c7c7'                        }, {                            xtype: 'panel',                            id: 'doc-west-panel' + this.unid,                            region: 'west',                            autoScroll: true,                            width: 250,                            border: false                        }]                    });                                        this.OutlinePanel = Ext.getCmp('doc-west-panel' + this.unid);                    this.CenterPanel = Ext.getCmp('doc-center-panel' + this.unid);                }                else { // Create Viewport                    this.documentlayout = new Ext.Viewport({                        id: 'pnl-' + this.unid,                        border: true,                        layout: 'border',                        items: [{                            xtype: 'panel',                            region: 'center',                            id: 'doc-center-panel' + this.unid,                            layout: 'fit',                            border: false,                            bodyStyle: 'border-left:1px solid #c7c7c7'                        }, {                            xtype: 'panel',                            id: 'doc-west-panel' + this.unid,                            region: 'west',                            width: 250,                            border: false                        }]                    });                                        this.OutlinePanel = Ext.getCmp('doc-west-panel' + this.unid);                    this.CenterPanel = Ext.getCmp('doc-center-panel' + this.unid);                                                        }            },    shownotify: function(unid){        Ext.form.Field.prototype.msgTarget = 'side';                var win = new Ext.Window({            id: 'formloadsubmit-win',            title: 'Send a link to a friend',            layout: 'fit',            width: 350,            height: 240,            closable: true,            border: false,            modal: true //,items:{id:'formloadsubmit-form', xtype:'i7notifyform'}            ,            items: [new i7.NotifyForm({                id: 'notify-form',                unid: unid,                lang: this.Lang            })]        });                win.show();            }        }
