Show cool things you have done with our products


Post by softwarezman »

I have added the ability to set the timeline bar to GMT for any browser (do a lot of govt stuff and this is pretty much the standard). I would post the code but I'm not sure if its an issue to post the whole plugin as it's a minor tweak from the original with an extra function created and a change to the way the records are created. Does anybody (mats or anybody) mind if I post it or is that an issue?

Post by mats »

We'd love to see it, please post all you want :)

Post by softwarezman »

The changes to the original are:
/**
	 * @cfg {Boolean} useUTCTime true to set the timline line to Zulu (UTC) time for all viewers
	 */
	useUTCTime: false,
    
    init : function(cmp) {
        var store = Ext.create("Ext.data.JsonStore", {
            model : Ext.define("TimeLineEvent", {
                extend : 'Ext.data.Model',
                fields : ['Date', 'Cls', 'Text']
            }),
            data : [{Date : this.getTime(), Cls : 'sch-todayLine', Text : this.tooltipText}]
        });
        var record = store.first();

        if (this.autoUpdate) {
            this.runner = Ext.create("Ext.util.TaskRunner");
			var me = this;
            this.runner.start({
                run: function() {
                    record.set('Date', me.getTime());
                },
                interval: this.updateInterval 
            });
        }

        cmp.on('destroy', this.onHostDestroy, this);
        
        this.store = store;
        this.callParent(arguments);
    },
	
	getTime: function() {
		var gmtDate = new Date();
		if(this.useUTCTime) {
			return new Date(gmtDate.getTime()+(gmtDate.getTimezoneOffset()*36000));
		} else {
			return gmtDate;
		}
	},
Full file is attached. It works for me. This isn't an operational system yet so I haven't done testing across different time zones but it should work ok.
Attachments
CurrentTimeLine.js
(2.44 KiB) Downloaded 478 times

Post Reply