Half day bookings different key to choose

Re: Half day bookings different key to choose

Postby chris » Fri Apr 04, 2008 4:13 pm

OK, so I pretty much follow most of that, I have always used the complete php tags <?php ?> and was glad to have that "inbuilt" habit when I started integrating xml data :)
I have clearly been following the wrong path as regards leaving the php open and I will hereby make a concerted effort to "not do it again" :oops:
However I maintain (as you have concluded) that readability is important so will have to find my own "balance". I generally tend to "work alone" so I am not too worried about others messing with my php code though it is a valid point.

I have been checking out that site that you posted - it would seem ideally suited to me other than for the fact that I don't "work alone" in the UK (I am in Spain) - am I still allowed to join?

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

Re: Half day bookings different key to choose

Postby boldfish » Fri Apr 04, 2008 4:26 pm

I have been checking out that site that you posted - it would seem ideally suited to me other than for the fact that I don't "work alone" in the UK (I am in Spain) - am I still allowed to join?


You'd be very welcome. We're pretty relaxed about where members actually work! in fact we have France, Dubai and Spain dwellers on the list, which is a healthy mix of developers and designers. We use it to sound off as you would in an office environment and for peer review and encouragement, so there's a good mix of banter and technical topics. It's very much for those of us starved of human company during our working day - a virtual team environment if you will.

see you there?

;)
boldfish
 
Posts: 25
Joined: Fri Apr 04, 2008 10:04 am

Re: Half day bookings different key to choose

Postby boldfish » Tue Apr 08, 2008 1:15 pm

Okay, so it's live here:
http://www.lanzluxuryvillas.com/

e.g.
http://www.lanzluxuryvillas.com/propdetail.php?id=147

next question, how hard would it be to extend the bookings part (not necessarily the display part) so that bookings could be recorded more than twelve months hence?

and, how hard would it be to have a provisional booking state?

;)
boldfish
 
Posts: 25
Joined: Fri Apr 04, 2008 10:04 am

Re: Half day bookings different key to choose

Postby chris » Tue Apr 08, 2008 2:51 pm

Hi again,
The web looks great :)

Adding a "provisional" booking state shouldn't be too hard at all.
In the version that you are using (ie version2) it uses a db table column called "state" to record the booking states which currently are "all" (full day booked) "am" and "pm".
This column could actually accept any state that you feel like creating.
I deliberately didn't use a "enum" column for this reason, it makes it easier to add states "on the fly" without having to go back and update the table structure.
If it weren't for the fact that I was trying to make the database structure as simple as for "newbies", I would actually have created a further table called something like "booking_states" and insert the various states there and just use the id in the calendar table rather than the string - I my opinion this would be the best and most flexible way to do it. However, as is the script right now this could not be completely automatic as you would still have to modify the js code to add the key functions (we could of course add php to the javascript function that detects the keystrokes and this dynamic too ;) ).
All of this is somewhere in my roadmap and will someday get added.

So, back to your question about adding the "provisional" state:
1. -Decide on the code for your new state eg. "tmp" or "prv" (note - these examples use 3 chars as I have made the column only 3 chars long, though that could easily be adjusted)
2. - Modify the "en.lang.php" file to add this state to the translation - eg $lang["key_booked_prv"] = "Provisional";
3. - Create a new set of image files for this new state with the background colour of your choice ( a future version of the script will remove the need for all these image files and allow the background colour to be dynamic)
4. Decide on the keystroke that you want to use to detect this new state (I'll leave that up to you) and modify the js file "function what_key(e)" so as to detect and return this state to the ajax file.
There is NO need to modify the ajax as this "just" modifies the db table with the state sent.

As to showing more than the current 12 month period (at least for admin), can you take a look at this thread (specifically the post that I have linked) and see if it might work for what you want: viewtopic.php?f=9&t=20&st=0&sk=t&sd=a#p125
Here I have adapted the script to jump forwards or backwards in 3 month blocks, but there is no reason why this couldn't be in 12 month blocks (it gets complicated if the calendar tries to show more than 12 months at a time)

I hope this is what you where after ;)

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

Re: Half day bookings different key to choose

Postby boldfish » Tue Apr 08, 2008 2:59 pm

There I was expecting a no…

thanks for that, I shall investigate when I have a spare hour or two!

;)
boldfish
 
Posts: 25
Joined: Fri Apr 04, 2008 10:04 am

Re: Half day bookings different key to choose

Postby boldfish » Tue Apr 08, 2008 3:02 pm

one thing, excuse my ignorance,
4. Decide on the keystroke that you want to use to detect this new state (I'll leave that up to you) and modify the js file "function what_key(e)" so as to detect and return this state to the ajax file.


where do I find the names for the keys, and would key combinations work? e.g alt+shift for provisional perhaps? what would that look like in what_key(e)

TIA

:)
boldfish
 
Posts: 25
Joined: Fri Apr 04, 2008 10:04 am

Re: Half day bookings different key to choose

Postby chris » Tue Apr 08, 2008 3:17 pm

This is the one question I knew you where going to ask and don't as yet, have the answer for :(

Since reading your first post today I have been googling and checking up on all my javascript links and, whilst there are many articles and references out there, I can't seem to get them to work in the calendar environment , mainly because I am passing the "event" within the href on the numbers rather than detecting it on the page itself - maybe I need to change this....

I am still looking into it, in the meantime however, here is a page that has a pretty complete javascript function to detect all keystrokes:
http://www.beansoftware.com/ASP.NET-Tut ... etect.aspx
now, if I can just get it to work for the calendar....

Hopefully I will get back with an answer soon (after lunch) if you don't beat me too it ;)

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

Re: Half day bookings different key to choose

Postby chris » Tue Apr 08, 2008 3:40 pm

Do you have a mac?
if so, could you test this out with the controls as befor plus "p" for "provisional" and see what happens (I haven't created the provisional state yet, I just want to see if the keycodes are the same)
http://www.cbolson.com/code/availabilit ... rsion2.0/#

you should get 2 alerts - first one is the keycode number, the second is the result (am, pm or prv")


Thanks

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

Re: Half day bookings different key to choose

Postby boldfish » Tue Apr 08, 2008 3:55 pm

not sure that's working properly, seems to retain the last key code.

alt click gets me 18 am
shift click gets me 16 pm
p click gets me 80 ko

if i do a plain click after any of those I get the number from the previous key and ko (so if it was pm a plain click still does pm - probably the alerts messing it up)

hope that helps?
boldfish
 
Posts: 25
Joined: Fri Apr 04, 2008 10:04 am

Re: Half day bookings different key to choose

Postby chris » Tue Apr 08, 2008 4:16 pm

OK, I have removed the alerts, fixed an error detecting the "prov" state (p key)

Try again, now you should just get an alert if it is "provisional" as I haven't created the images yet - I'm working on them right now ;)

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

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron