Where can I get version with "Provisional" booking?

Where can I get version with "Provisional" booking?

Postby CasaJags » Sat Jul 25, 2009 1:22 pm

Hi Chris,

Your calendar has pretty much most of the features I am looking for, which is great. But is this version available at all?

http://www.cbolson.com/code/availability-calendar/version2.0/

I am looking for the "Provisional" booking feature and the ability to move forwards by 12 months [via link, rather than select].

Kind regards,

Steve
CasaJags
 
Posts: 5
Joined: Sat Jul 25, 2009 1:13 pm

Re: Where can I get version with "Provisional" booking?

Postby ScottSOP » Wed Jul 29, 2009 4:39 pm

I'd love to have this version too. Even if it were just a beta or something.
ScottSOP
 
Posts: 3
Joined: Mon Jul 27, 2009 6:20 pm

Re: Where can I get version with "Provisional" booking?

Postby chris » Mon Aug 03, 2009 10:43 am

Hi,
sorry for the delay in replying.

The steps reqquired to get the provisional booking and the ability to change the peroid being shown are detailed in other posts within this forum.

However, I am currently working on a new version of the calendar which includes the provisional bookings and infact the possibility to add whatever states you like.
It will also have the ability to change the months being shown.

I will hopefully be able to release a n initial version sometime this week.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Where can I get version with "Provisional" booking?

Postby CasaJags » Thu Aug 13, 2009 9:58 pm

Hi Chris,

Thanks for your answer. Could you point out which posts this is detailed in, because I cannot find it? Also, how is the new version progressing?

TIA

Steve

EDit: No worries, I have found it. It was quite easy to do.

For those of you who want to add this function, here is what to do.

1. Create your provisional booking .png files. I copied the cal_off_*.png files and just "colourised" them in PS. Remember to save the files using a different name. My provisional booking ajax.response is called pr so my image files are called cal_pr_*.png. Upload your new image files to your server.

2. Update your update_cal.js file, adding the line || ajax.response=="pr"

Code: Select all

function reset_state(){
   //alert(ajax.response);
   if (ajax.response=="on"
   ||  ajax.response=="off"
   ||  ajax.response=="am"
   ||  ajax.response=="pm"
         ||  ajax.response=="pr"
   )



3. Further update your update_cal.js file, adding the line else if(e.shiftKey) return "pr"; [so you will use the shift key to "provisionally book" dates]

Code: Select all
   
function what_key(e) {

   if(document.all)e = event; // IE need this
   //alert(e);
      if(e.ctrlKey)      return "am";
      else if(e.altKey)   return "pm";
         else if(e.shiftKey)   return "pr";
   else return "ko";
}



4. Update your functions.inc.php file, adding the line elseif($booked_days[$this_date]=="pr") $day_image='cal_pr_'.$day_counter.'.png';

Code: Select all

         //   check if day is available
         if(array_key_exists($this_date,$booked_days)){
            //echo "<br>".$booked_days[$this_date];
            if($booked_days[$this_date]=="am")      $day_image='cal_am_'.$day_counter.'.png';
            elseif($booked_days[$this_date]=="pm")   $day_image='cal_pm_'.$day_counter.'.png';
                  elseif($booked_days[$this_date]=="pr")   $day_image='cal_pr_'.$day_counter.'.png';
            else                     $day_image='cal_on_'.$day_counter.'.png';
         }



I think that is all I did, and I hope this helps those who are wanting to add this function to their site before Chris releases the latest version which hopefully has it included. .
CasaJags
 
Posts: 5
Joined: Sat Jul 25, 2009 1:13 pm

Re: Where can I get version with "Provisional" booking?

Postby mrmemanuele » Mon Oct 19, 2009 3:55 pm

Hi

I would like to be able to use just letters for example 'o' to make provisional booking

i have tried with

Code: Select all
function what_key(e) {
   if(document.all)e = event; // IE need this
   //alert(e);
      if(e.ctrlKey)      return "am";
      else if(e.altKey)   return "pm";
         else if(e.P)   return "pr";
   else return "ko";
}


and with

Code: Select all
function what_key(e) {

   if(document.all)e = event; // IE need this
   //alert(e);
      if(e.ctrlKey)      return "am";
      else if(e.altKey)   return "pm";
         else if(80)   return "pr";
   else return "ko";
}



but not working.

Appreciate any help

em
mrmemanuele
 
Posts: 4
Joined: Mon Oct 19, 2009 3:03 pm

Re: Where can I get version with "Provisional" booking?

Postby chris » Mon Oct 19, 2009 4:35 pm

Hi there,

ctrlKey is only any use for a few "control" keys (eg command, shift, space etc)
For "normal" keystrokes (letters and numbers and specual chars) you need to use charCode

However, be aware that this itself doesn't return the "value" of the key, rather it's numerical position.

So, for the "o" key I think that you need to check for "111" and the "p" key is "112"

You can get the actual "value" of the keypressed by doing something like this:

Code: Select all
val=String.fromCharCode(e.charCode);


I hope that this might help you get what you need working :)

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Where can I get version with "Provisional" booking?

Postby mrmemanuele » Mon Oct 19, 2009 4:50 pm

Hi Chris thanks for your replay

This is the function

Code: Select all
function what_key(e) {
   if(document.all)e = event; // IE need this
   //alert(e);
      if(e.ctrlKey)      return "am";
      else if(e.altKey)   return "pm";
   else if(e.shiftKey)   return "pr";
   else if(112)   return "ow";
   else return "ko";

}


so when i press the 'p' the color is changing but when i click on other days with out pressing the 'p' is still color the day as per "ow" return...

thanks for your help
mrmemanuele
 
Posts: 4
Joined: Mon Oct 19, 2009 3:03 pm

Re: Where can I get version with "Provisional" booking?

Postby chris » Tue Oct 20, 2009 8:05 am

Hi, I am not convinced that by just adding if(112) return "ow" you are actually checking anything.
What do you get if you uncomment the line alert(e); ?

Can you send me an url of what you are doing as it is hard to guess what is happening without seeing it.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Where can I get version with "Provisional" booking?

Postby mrmemanuele » Wed Oct 21, 2009 3:57 am

Hi Chris

You are right, if i uncomment the line alert(e) I'm receiving 0 , so is not passing the value as you said.

I'm integrate your calendar in a yacht solution website where i need to be able to show at list 5 different type of booking:
green -> owner booking
red--> provisional booking
blue-> charter booking and so on

What i try to do is avoid using the shit key or alt key or ctrl key but use just letter.
For example for provisional booking hold the 'p' and click
for owner bookings hold the 'o' and click
for charter booking hold 'c' and click and so on.

I have a look at your example here http://www.cbolson.com/code/availability-calendar/version2.0/ and look at the update_cal.js you are using this function to be able to use the 'o' for provisional booking

Code: Select all
function ajax_mod_state(id_item,the_date,the_num,e){   
   //catch key press
   keycode=document.getElementById('current_key').value;
   special_state="";
   if(keycode=="16")      special_state= "pm";   // SHIFT KEY
   else if(keycode=="17")   special_state= "pm";   //   ctrl
      else if(keycode=="18")   special_state= "am";   //   alt
   else if(keycode=="80")   special_state= "prv"   //   o
   //else the_key= "ko";



I have tried to implemented in my version but i'm getting undefined error on current_key...

So that's why i was try to use this code

Code: Select all
function what_key(e) {
   if(document.all)e = event; // IE need this
   //alert(e);
      if(e.ctrlKey)      return "am";
      else if(e.altKey)   return "pm";
   else if(e.shiftKey)   return "pr";
   else if(112)   return "ow";
   else return "ko";

}


Thanks for your help

Em
mrmemanuele
 
Posts: 4
Joined: Mon Oct 19, 2009 3:03 pm

Re: Where can I get version with "Provisional" booking?

Postby chris » Wed Oct 21, 2009 12:21 pm

Hi, the function that you are modding is not used (at least in the version that you have pointed me too) - you should see that it is comment out.

The function to modify is ajax_mod_state(id_item,the_date,the_num,e)

If you add alert(keycode); you should see what the code is for the key that you have pressed when you click on a date.
It worked fine for me.

If you can't get it working, I would really need to see your url (pm me if you preferr) to see what is going wrong.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Next

Return to General

Who is online

Users browsing this forum: No registered users and 0 guests

cron