AJAX Calendar Script modification

AJAX Calendar Script modification

Postby nath2099 » Mon Jan 26, 2009 2:34 am

Hi Chris, great script you have here, it has been very useful!

I was wondering if you may be able to help me with a slight modification. I am trying to set it up so that when a date is selected by a mouse click only, there are no modifications to the actual calendar.. it will just open a popup window. I have changed the full day booking method to shiftClick in this line in update_cal.js
Code: Select all
function what_key(e) {

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

this all works ok except when a date is clicked only (not shiftClicked) I get a javascript alert "undefined". I have got it to open a window and can take care of anything in that window myself.
This is being used on this site http://www.freelance-crew.com/profile.htm?member=1 and I want to allow the popup window so that the user can keep an online diary of who has booked them. If you could point me in the right direction that would be great!

Cheers, Nathan.
nath2099
 
Posts: 1
Joined: Mon Jan 26, 2009 2:23 am

Re: AJAX Calendar Script modification

Postby chris » Mon Jan 26, 2009 10:12 pm

Hi there, thanks for the comments :)

So, you want a "normal" mouse click to not update the calendar at all but rather to open a window. Only the combination of a keystroke and a mouse click should change the state.

Well, in the ajax_mod_state() function we are defining the keystroke as a variable "the_key", so, we could use this to also condition the action taken by the javscript.
Something like:
Code: Select all
if(the_key!="ko"){
  //    call ajax file to update state
  var the_url=update_url+"?id_item="+id_item+"&the_date="+the_date+"&special_state="+special_state;
 
  ajax.requestFile = the_url;
  ajax.onCompletion =reset_state;
  ajax.runAJAX();
}else{
  //open window
  //your javascript code here for opening the window
}

Is this what you where after?
Let me know if you need more help or I have missed the point.

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


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest