<fim-prefix>is, config);
    Tine.widgets.relation.GridRenderer.superclass.constructor.call(this);
};

Ext.extend(Tine.widgets.relation.GridRenderer, Ext.Component, {
    appName:      null,
    type:         null,
    foreignApp:   null,
    foreignModel: null,
    relModel:     null,
    recordClass:  null,
    
    /**
     * initializes the component
     */
    initComponent: function() {
        Tine.log.debug('Initializing relation renderer with config:');
        Tine.log.debug('appName: ' + this.appName + ', type: ' + this.type + ', foreignApp: ' + this.foreignApp + ', foreignModel: ' + this.foreignModel);
        this.relModel = this.foreignApp + '_Model_' + this.foreignModel;
    },
    
    /**
     * 
     * @param {Array} relations
     */
    render: function(relations) {
        if ((! relations) || (relations.length == 0)) {
            return '';
        }
        
        if (! this.recordClass) {
            if (! Tine[this.foreignApp]) {
                Tine.log.warn('Tine.widgets.relation.GridRenderer::render - ForeignApp not found: ' + this.foreignApp);
                return '';
            }
            
            this.recordClass = Tine[this.foreignApp].Model[this.foreignModel];
        }
        
        for (var index = 0; index < relations.length; index++) {
            var el = relations[index];
            if (el.type == this.type && el.related_model == this.relModel) {
                var record = new this.recordClass(el.related_record);
                // BUG: CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
                // return record.getTitle();
                // FIXED:
 <fim-middle>               return Ext.util.Format.htmlEncode(record.getTitle());
            }
        }
    }
});
<fix-suffix><|endoftext|>