PDA

View Full Version : Clock for 2.0 Desktop



gsylvain35
11 Jan 2008, 10:56 AM
Hi sylvain,

Could you post complete code & howto install it ?

We will try to help you to make this work

Yannick, french Ext user too


complete code

demo : http://gsylvain35.free.fr/desktop/

DragonFist
11 Jan 2008, 11:14 AM
Demo not working in IE.

"Identifier Expected" errors. Most likely trailing commas.

Ytorres
11 Jan 2008, 11:24 AM
Hi Sylvain & thanks for this :)

I will install it & try to help you on it.

franckxx
11 Jan 2008, 1:46 PM
New Topic started....cool !

I go to install it too... but no lot of chance to find solution ARF.... (i'm so Newb) !!

Thx for your work Sylvain ;-)

hendricd
11 Jan 2008, 3:06 PM
@gsylvain35 (http://extjs.com/forum/member.php?u=16425) -- How come you still running 2.0B1 on that site?

Ytorres
12 Jan 2008, 1:03 AM
Hi Sylvain,

To make your clock refresh, do this :



Ext.ux.ClockPanel = Ext.extend(Ext.BoxComponent, {

initComponent : function(){

var time = getstartTime();
this.clockBtn = new Ext.Button({
text : time,
id: 'ux-clockbutton',
renderTo: 'ux-taskclock-panel',
template: new Ext.Template(
'<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>',
'<td class="ux-startbutton-left"><i> </i></td><td class="ux-startbutton-center"><em unselectable="on"><button class="x-btn-text" type="{1}" style="height:30px;" id="ux-clockbutton-text">{0}</button></em></td><td class="ux-startbutton-right"><i> </i></td>',
'</tr></tbody></table>')
});
var btn = this.clockBtn;
this.setWidth(Ext.get('ux-clockbutton').getWidth());

var updateClockTask = new Ext.util.DelayedTask(startTime);
updateClockTask.delay(500);

this.clockBtn.getEl().on('contextmenu', function(e){
e.stopEvent();
}, this);

this.clockBtn.getEl().on('click', function(e){
e.stopEvent();
}, this);

function startTime()
{
Ext.getDom('ux-clockbutton-text').innerHTML = getstartTime();
updateClockTask.delay(500);

}

function getstartTime() {
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
if(h<10)h = '0'+h;
if(m<10)m = '0'+m;
if(s<10)s = '0'+s;
return h+":"+m+":"+s;
}

}
});


Not very clean, but this do the trick.

gsylvain35
12 Jan 2008, 1:31 AM
Thx
good work

Ytorres
12 Jan 2008, 1:33 AM
Thx
good work

To add a calendar when user click on the clock, like Franckxx (http://extjs.com/forum/showthread.php?p=108221#post108221) suggest you, just do this :




this.clockBtn.getEl().on('click', function(e){
e.stopEvent();

var calendar = new Ext.menu.DateMenu();
calendar.show(Ext.get('ux-clockbutton'));

}, this);

franckxx
12 Jan 2008, 3:02 AM
It's just EXTcellent !!

THX a lot Yannick, too speed.....! <----- comme toujours

Ytorres
12 Jan 2008, 3:28 AM
Sylvain,

I suggest you to remove split bar for the clock panel.



this.cklPanel = new Ext.ux.ClockPanel({
el: 'ux-taskclock-panel',
id: 'TaskBarClock',
minWidth: 30,
region:'east',
split: false, // Remove splite bar
width: 85
});


Franck => ;)

franckxx
12 Jan 2008, 4:09 AM
Yes....

i do that too... ;)

http://img179.imageshack.us/img179/475/sanstitre1iq9.png

lol... les grands esprits se rencontres...h

israel
30 Jan 2008, 4:23 PM
can you give yore demo
clock domo plise
toda

watrboy00
7 Feb 2008, 5:19 PM
Here is a simple implementation of a clock. Could add in seconds if you wanted.



Ext.ux.Clock = function() {
this.init = function( btn ) {
Ext.TaskMgr.start({
interval: 1000, //runs every 1 sec
run: function() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var ampm = '';
if ( h < 10 ) {
ampm = 'AM';
} else if ( h > 12 ) {
h = h - 12;
ampm = 'PM';
}

if ( m < 10 ) m = '0' + m;

btn.setText( h + ":" + m + ' ' + ampm )
},
scope: this
});
}
};


Usage:


new Ext.Button({
menu: new Ext.menu.DateMenu({
//config options
}),
plugins: new Ext.ux.Clock()
});

israel
8 Feb 2008, 10:26 PM
were to pot this in deskop konfig???

israel
8 Feb 2008, 10:29 PM
??????????clock not working in my desktophttp://forum.score777.com/html/emoticons/!cid_000901c5d0be$89c06c20$0200000a@sigaljwnp5ad5d.gif

israel
14 Feb 2008, 2:14 AM
Could you post complete code & howto install it ?

Animal
14 Feb 2008, 4:52 AM
How much code have you posted for others to use?

Foggy
14 Feb 2008, 5:40 AM
And by the way, in this thread IS the code, just open up your eyes...

Marcoi
15 Feb 2008, 10:43 AM
Hi,
I have a warning and the taskbar is not shown, when I test the clock on the IE 7. on FF it is OK.

The problem is here:


function startTime()
{
Ext.getDom('ux-clockbutton-text').innerHTML = getstartTime(); // <-- Warning
updateClockTask.delay(500);
}


Waning please see attached png

Is there a bug fix for this problem? :D

regards
marcoi

franckxx
15 Feb 2008, 11:32 PM
Hi,
I have a warning and the taskbar is not shown, when I test the clock on the IE 7. on FF it is OK.

The problem is here:


function startTime()
{
Ext.getDom('ux-clockbutton-text').innerHTML = getstartTime(); // <-- Warning
updateClockTask.delay(500);
}


Waning please see attached png

Is there a bug fix for this problem? :D

regards
marcoi

cool, thx for this fix !

Marcoi
16 Feb 2008, 2:15 AM
cool, thx for this fix !

This is not a fix - it is is bug. I am searching for a fix. I don't know why IE 7 get an error:



Ext.getDom('ux-clockbutton-text').innerHTML = getstartTime();


In IE7 is
Ext.getDom('ux-clockbutton-text') = null

WHY????

Marcoi
22 Feb 2008, 9:00 AM
any ideas?

macno0b
8 Apr 2008, 11:56 AM
Sorry for thread-hijacking.

I am jut wondering if any of you guys know how to add a simple digital clock to this chat page like the below picture:

http://img221.imageshack.us/img221/4127/sp3220080408144723kq2.jpg

I might be something very easy to you but I havent quite figured out how to do that with extjs. Thanks for your helps

here is the code of the page:


var barMenu;
var barStatus;
var panelChat;
var storeChat;
var gridChat;

var barTop, barBottom;
var textBarBottom;

var viewport;
var layoutNorth, layoutSouth, layoutCenter, layoutEast;



function AppGo() {

var chatRecordType = [
{name: 'peopleid'},
{name: 'textchat'}
];

storeChat = new Ext.data.SimpleStore({
fields: chatRecordType,
data: [
['admin', 'Hello, welcome to chat room']
]
});

var resultTpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="itemChat">',
'<p><span><b>{peopleid}: </b></span>',
'<span>{textchat}</span></p>',
'</div></tpl>'
);


//gridChat = new Ext.DataView({
gridChat = new Ext.app.ChatView({
id: 'chat-View',
tpl: resultTpl,
store: storeChat,
//width: 400,
height: 150,
itemSelector: 'div.itemChat'
// columns: [
// {id: 'peopleid', header: "ID", width:80, sortable: false, dataIndex: 'peopleid'},
// {header: "Chat Text", width: 195, sortable: false, dataindex: 'textchat'}
// ]
});

panelChat = new Ext.Panel({
id: 'panel-Chat',
title: 'Chat',
frame: true,
collapsible: true,
width: 230,
height: 300,
x: 500 ,
y: 50,
autoScroll: true,
items: gridChat,
bbar: [
'Chat: ', ' ',
new Ext.app.ChatField({
chatRecordFormat: chatRecordType,
store: storeChat,
//gridSM: gridChat.getSelectionModel()
})
]
});

panelChat.getBottomToolbar().mypanel=panelChat;

barTop = new Ext.Toolbar({
});

barBottom = new Ext.Toolbar({
//height: 30,
//width: 1000,
});


layoutNorth={
region: 'north',
id: 'north-panel',
height: 30,
collabsible: false,
items: barTop
};

layoutSouth = {
region: 'south',
id: 'south-panel',
height: 30,
collabsible: false,
items: barBottom
};


layoutCenter = {
region: 'center',
id: 'center-panel',
layout: 'absolute',
items: panelChat
};

viewport = new Ext.Viewport({
layout: 'border',
items: [layoutNorth, layoutSouth, layoutCenter]
});

}

aicom
8 Apr 2011, 12:40 AM
hi,

I have implemented the clock button on my desktop. I'm step by step adding new features to the desktop sample as the clock, the quickstart or the autoload functions. I've updated my TaskBar.js and desktop.css as mentioned in this thread and everything works fine but the button: It's not transparent so the text showing the time that is in white text is almost invisible.
25539
Any idea? TIA,

Lola

Paul Ellis
20 Apr 2011, 6:10 AM
Couldn't install that
Is there any snapshots guide?

Thank You
Paul Ellis

Chris.s
25 Apr 2011, 4:44 AM
very nice
Thank You very much for the useful clock.

Chris

waftseo
27 Apr 2011, 3:42 AM
Guys i need full information about this . Installation , setup ect .:-?