HTML_calendar more info req.

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

HTML_calendar more info req.

Postby fabio2 » Wed Jul 12, 2006 2:19 pm

It's a grate facility!

I need same extra info about.

Is it possible to get marked only same days ( I chose ) to make for me one user friendly diagram?
I have to get one calendar for every rooms to get in relation the calendar with the free room for my work.


this is the job of "freecolours"
var date = new Date();
{
//If no parameter is passed use the current date.
if(date == null)
date = new Date();

day = date.getDate();
month = date.getMonth();
year = date.getFullYear();
months = new Array('gennaio',
'febbraio',
'marzo',
'aprile',
'maggio',
'giugno',
'luglio',
'agosto',
'settembre',
'ottobre',
'novembre',
'dicembre');

this_month = new Date(year, month, 1);
next_month = new Date(year, month + 1, 1);

//Find out when this month starts and ends.
first_week_day = this_month.getDay();
days_in_this_month = Math.floor((next_month.getTime() - this_month.getTime()) / (1000 * 60 * 60 * 24));

calendar_html = '<html>' +
'<style type="text/css"><!--' +
'Lu Ma Me Gi Ve Sa Do '+
'--></style>' +
'<body>' +
'<table border="1" cellspacing="0" cellpadding="0">' +
'<tr>' +
'<td bgcolor="ffffff">' +
'<table style="background-color:bfc7db; color:ffffff;">';

calendar_html += '<tr><td colspan="7" align="center" style="background-color:#ffcc00; color:000000;">' +
'<font size="3" color="083767" face="Verdana"> <b>' +
months[month] + ' ' + year + '</b></td></tr>';

calendar_html += '<tr>';

//Fill the first week of the month with the appropriate number of blanks.
for(week_day = 1; week_day < first_week_day; week_day++)
{
calendar_html += '<td style="background-color:bfc7db; color:000000;">' +
'<font size="1" face="Verdana"> </td>';
}

week_day = first_week_day;
for(day_counter = 1; day_counter <= days_in_this_month; day_counter++)
{
week_day %= 7;

if(week_day == 1)
calendar_html += '</tr><tr>';

//Do something different for the current day.
if(day == day_counter)
calendar_html += '<td align="center" valign="middle" style="background-color:083767"><b>' + day_counter + '</b></td>';
else
calendar_html += '<td align="center" valign="middle" style="background-color:bfc7db; color:000000;"> ' +
day_counter + ' </td>';

week_day++;
}

calendar_html += '</tr>';
calendar_html += '</table></td></tr></table></body></html>';

//Display the calendar.
globals.gCalender = calendar_html;
}


thank you
fabio2
 
Posts: 7
Joined: Mon Nov 15, 2004 10:58 pm

Postby fabio2 » Fri Jul 14, 2006 12:59 am

any one can help me ?
fabio2
 
Posts: 7
Joined: Mon Nov 15, 2004 10:58 pm

Re: HTML_calendar more info req.

Postby Karel Broer » Fri Jul 14, 2006 10:07 am

fabio2 wrote:It's a grate facility!

Thanks!
I need same extra info about.
Is it possible to get marked only same days ( I chose ) to make for me one user friendly diagram?
I have to get one calendar for every rooms to get in relation the calendar with the free room for my work.

Can you explain a bit more in detail what you really want and where you want to get data from?
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Postby fabio2 » Fri Jul 14, 2006 12:46 pm

Thank you for the Replies,

I need a calendar for every one room with the occupied day marked.

So I can instantly see on the calendar , marked with different colors the occupied days, for every room .

Example:
Room N1 occupied from 10 to 14 July
room N 4 occupied from 5 to 18 July

(Table rooms with: the fields "from_date" and "To_date" and field "Room_number")
fabio2
 
Posts: 7
Joined: Mon Nov 15, 2004 10:58 pm

Postby Riccardino » Sat Jul 15, 2006 12:37 pm

fabio2 wrote:Thank you for the Replies,

I need a calendar for every one room with the occupied day marked.

So I can instantly see on the calendar , marked with different colors the occupied days, for every room .

Example:
Room N1 occupied from 10 to 14 July
room N 4 occupied from 5 to 18 July

(Table rooms with: the fields "from_date" and "To_date" and field "Room_number")


I'm afraid what you're looking will require some work: you don't need a calendar, actually, but a reservation system.
So you have to build a set of queries that will assign a colour to a day if a room is busy in that particular date.

You can find some sample code, to use with the code of the beautiful calendar of Freecolors, on Servoy magazine (look for "html agenda").

But, again, it will require a lot of work... :-)
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Postby Karel Broer » Sat Jul 15, 2006 12:52 pm

fabio2 wrote:I need a calendar for every one room with the occupied day marked.

Does this mean that you want a separate calendar for every room?
In this case you need to get an array with days that the defined room is occupied and -while you set the table row for each day- compare this with the days that you set in the calendar. Done! :wink:

In case you want to see multiple rooms on one calendar, it is possible, but things get a bit more complex, because the calendar containes only one table row for each day (<tr></tr>). If you want to have more rooms listed in one day, you need to set multiple table rows in one day. I assume that you reserve the row amount from the number of rooms you total have each day. But as I said, it is possible, but a bit more complex.
Karel Broer
ServoyCamp - http://www.servoycamp.com
User avatar
Karel Broer
 
Posts: 779
Joined: Mon May 03, 2004 12:49 am
Location: Doetinchem

Postby fabio2 » Sat Jul 15, 2006 2:15 pm

thank you Freecolours and Riccardino

Does this mean that you want a separate calendar for every room?
In this case you need to get an array with days that the defined room is occupied and -while you set the table row for each day- compare this with the days that you set in the calendar. Done!


this is right
Last edited by fabio2 on Mon Jul 17, 2006 5:24 pm, edited 4 times in total.
fabio2
 
Posts: 7
Joined: Mon Nov 15, 2004 10:58 pm

Postby fabio2 » Mon Jul 17, 2006 5:20 pm

Can same one explain me the exact way to do this... :oops:
fabio2
 
Posts: 7
Joined: Mon Nov 15, 2004 10:58 pm

Postby Riccardino » Mon Jul 17, 2006 5:45 pm

fabio2 wrote:Can same one explain me the exact way to do this... :oops:


Not so easy.
First of all, you've to decide where you want to display this information.

In a record view? Build a procedure according to Karel's suggestions and put an OnRecordSelect method that will fire a new query every time you move to a different room.

But if you need a list of rooms and you've got to display all the different calendars for each row, the matter is much more complicated.
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Postby fabio2 » Wed Jul 19, 2006 3:38 pm

Ciao Ric,
Not so easy.

If for you It's not so easy.
for me it's verry difficoult.

Thank you for your replay

Any other suggestions are welcome.

cheers Fabio
fabio2
 
Posts: 7
Joined: Mon Nov 15, 2004 10:58 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 10 guests