[go: up one dir, main page]

Menu

[r21]: / calendar.php  Maximize  Restore  History

Download this file

1276 lines (1087 with data), 45.3 kB

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
<?php
$pageRef='Calendar';
include('includes/header.php');
//Il giorno richiesto
$oDay = $_GET[day];
$oMonth = $_GET[month];
$oYear = $_GET[year];
$myDay = $_GET[day];
$myMonth = $_GET[month];
$myYear = $_GET[year];
//Se non sono riuscito a capire il giorno allora scelgo oggi e ricarico la pagina
if((!$myDay) || (!$myMonth) || (!$myYear)){
$reloadDay = date("d");
$reloadMonth = date("m");
$reloadYear = date("Y");
echo "<script>document.location.href='http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/calendar.php?day=" . $reloadDay . "&month=" . $reloadMonth . "&year=" . $reloadYear . "';</script>";
}
//Leggo e utilizzo i dati passati nell'url
$aClient = $_GET[cid];
if(($aClient == '0') || ($aClient == '')){
$aName = $_GET[pro];
$aTelephone = $_GET[tel];
$aMobile = $_GET[cel];
$aOffice = $_GET[uff];
$aAddress = $_GET[add];
$anEmail = $_GET[mai];
}else{
$aName = '#';
$aTelephone = '#';
$aMobile = '#';
$aOffice = '#';
$aAddress = '#';
$anEmail = '#';
}
$aVet = $_GET[vet];
$aLocation = $_GET[loc];
$aDate = $_GET[dat];
$aHour = $_GET[hou];
$aPeriod = $_GET[dur];
$aComment = $_GET[comm];
$milliDate = mktime(0,0,0,$myMonth,$myDay,$myYear);
$dayOfTheWeek = date("D",$milliDate);
if($dayOfTheWeek == 'Mon'){
$myDay=$myDay;
}elseif($dayOfTheWeek == 'Tue'){
$myDay=$myDay-1;
}elseif($dayOfTheWeek == 'Wed'){
$myDay=$myDay-2;
}elseif($dayOfTheWeek == 'Thu'){
$myDay=$myDay-3;
}elseif($dayOfTheWeek == 'Fri'){
$myDay=$myDay-4;
}elseif($dayOfTheWeek == 'Sat'){
$myDay=$myDay-5;
}elseif($dayOfTheWeek == 'Sun'){
$myDay=$myDay-6;
}
//Monday
$startDay = date("d",mktime(0,0,0,$myMonth,$myDay,$myYear));
$startMonth = date("m",mktime(0,0,0,$myMonth,$myDay,$myYear));
$startYear = date("Y",mktime(0,0,0,$myMonth,$myDay,$myYear));
//Sunday
$endDay = date("d",mktime(0,0,0,$myMonth,$myDay+6,$myYear));
$endMonth = date("m",mktime(0,0,0,$myMonth,$myDay+6,$myYear));
$endYear = date("Y",mktime(0,0,0,$myMonth,$myDay+6,$myYear));
?>
<script>
//<CONSTANTS>
var NO_OPERATION = 0;
var CUT_OPERATION = 1;
var COPY_OPERATION = 2;
var calendarPortion = 0.73; //Percentage of the window used to show calendar
var calendarWidth = document.viewport.getWidth() * calendarPortion; //Viewport portion used to show calendar
var divDayWidth = Math.floor((85 * calendarWidth)/1000); //Width of a dayBox
var divDayHeight = 20; //Height of a dayBox
var divHourWidth = Math.floor((34.6 * calendarWidth)/1000); //Width of an hourBox
var divHourHeight = 20; //Height of an hourBox
//</CONSTANTS>
var numOfCalendarTables = 0;
var doctorOfCalendarTables = new Array();
var newClientDetailsFields; //Array of new clients info input. It's initialized in the onLoad function
var appDivs = new Array(); //Array of appointment box
var appNumber = 0; //Number of appointment box
var tabDivs = new Array(); //Array of empty box
var tabNumber = 0; //Number of appointment box
var dragStartTop = 0;
var dragStartLeft = 0;
var resizeStartWidth = 0;
var selectedBox = null; //The box selected
//I must record the boxes position because the div properties left, top and width are not updated after a drag&drop,resize or cut&paste operation.
//So in the future I will record all data in appDivs array.
<?php
mysql_query("BEGIN");
$result = mysql_query("SELECT * FROM cutandpaste WHERE cutId='1'");
if(mysql_num_rows($result)){
while($row = mysql_fetch_array($result)){
$capStatus = $row[status];
}
}else{
$capStatus = 0;
}
mysql_query("COMMIT");
echo "var thereIsAnAppointmentToBeCopied = " . $capStatus . ";";
?>
function num2Place(num){
var place;
switch(num){
case 0:
place = 'visitAppBox';
break;
case 1:
place = 'homeVisitAppBox';
break;
case 2:
place = 'extCommitmentAppBox';
break;
case 3:
place = 'holidayAppBox';
break;
default:
place = 'visitAppBox';
}
return place;
}
function place2Num(place){
var num;
switch(place){
case 'visitAppBox':
num = 0;
break;
case 'homeVisitAppBox':
num = 1;
break;
case 'extCommitmentAppBox':
num = 2;
break;
case 'holidayAppBox':
num = 3;
break;
default:
num = 3;
}
return num;
}
/***************************************** INIT BOXES (START) *****************************************/
/**************************************/
/* Places and records the empty boxes */
/**************************************/
function calendarOnLoad(calendar, doc){
var dIndex = 0;
var hIndex = 0;
var divID = 'div';
var divObj;
var oldTableHeight = parseInt($('calendarTable').style.height);
for(dIndex = 0; dIndex < 8; dIndex++){
for(hIndex = 0; hIndex < 27; hIndex++){
divID = 'div'+calendar+'_'+dIndex+'_'+hIndex;
divObj = $(divID);
tabDivs[tabNumber]=divObj;
tabNumber++;
if(hIndex == 0){
divObj.style.left = 0 + divHourWidth / 2 + "px";
divObj.style.top = (divDayHeight + 1) * dIndex + 130 + 240 * calendar + 3 * divDayHeight + "px";
divObj.style.width = divDayWidth+"px";
}else{
divObj.style.left=(divDayWidth + 1) + (divHourWidth + 1) * (hIndex-1) + divHourWidth / 2 + "px";
divObj.style.top = (divDayHeight + 1) * dIndex + 130 + 240 * calendar + 3 * divDayHeight + "px";
divObj.style.width = divHourWidth+"px";
}
}
}
$('calendarTable').style.height = divDayHeight * 8 + 90 + oldTableHeight + "px";
doctorOfCalendarTables[numOfCalendarTables]=doc;
numOfCalendarTables++;
}
/**************************************/
/* Places and records the app boxes */
/**************************************/
function appOnLoad(elem){
var args = elem.getAttribute("name").split("_");
var appSqlID = args[0];
var calendar = parseInt(args[1]);
var day = parseInt(args[2]);
var startTime = args[3];
var duration = parseInt(args[4]);
var app = args[5];
var appBoxID = 'app'+app;
var appObj = $(appBoxID);
var subStr = new Array();
var ctrlHalf = 0;
var divObj;
var hour;
//resize and place the appBox - start
subStr = startTime.split(":");
if(subStr[1] == 30){
ctrlHalf=1;
}
hour = (subStr[0]-8)*2 + ctrlHalf + 1;
appObj.style.left = (divDayWidth + 1) + (divHourWidth + 1) * (hour-1) + divHourWidth / 2 + "px";
appObj.style.top = (divDayHeight + 1) * day + 130 + 240 * calendar + 3 * divDayHeight + "px";
appObj.style.width =(duration/30)*(divHourWidth) + ((duration/30) - 1) + "px";
//resize and place the appBox - end
//make the appBox draggable and resizeable - start
new Draggable(appBoxID,{zindex: +5, handle: 'handle1', onStart: function (){dragStart(appBoxID)}, onEnd: function (){dragEnd(appBoxID, calendar)}});
new Resizeable(appBoxID, {top: 0, left: 0, right: 6, bottom: 0, minWidth: divHourWidth - 1, delta: divHourWidth+1, deltaFun: function(el){onResizing(el);}, resize: function(el){resizeEnd(el);}});
//make the appBox draggable and resizeable - end
//Event.observe($(appObj),'dblclick', function(e){showAppDetails($(appObj));});
//Event.observe($(appObj),'mousedown', function(e){Event.stop(e); clickOnTable(e, 'div');})});
//record the app - start
appDivs[appNumber]=appObj;
appNumber=appNumber+1;
//record the app - end
}
/***************************************** INIT BOXES ( END ) *****************************************/
/***************************************** Drag & Drop (START) *****************************************/
/****************************/
/* Drag&drop start function */
/****************************/
function dragStart(appBoxID){
var appObj = $(appBoxID);
//Save the start coordinates, they may be usefull at the end
//of the drag&drop operation to restore a wrong placement
dragStartTop = appObj.style.top;
dragStartLeft = appObj.style.left;
}
function successInDraggingAppF(transport){
var args=transport.responseText.evalJSON();
var box=$(selectedBox);
//Success in updating request
//Operation result advice
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
//Success in updating DB
//NOTHING TO DO
}else{
//Failure in updating DB
//The app backs to its old place
box.style.left = dragStartLeft;
box.style.top = dragStartTop;
}
}
function failureInDraggingAppF(){
var box=$(selectedBox);
//Failure in updating request
//The app backs to its old place
box.style.left = dragStartLeft;
box.style.top = dragStartTop;
//Failure advice
alert('<?php echo _T("NI_calendar_") ?>');
}
/**************************/
/* Drag&drop end function */
/**************************/
function dragEnd(appBoxID, calendar){
var draggedObj = $(appBoxID);
var divID;
var divObj;
var newPlace;
var forIndex;
selectionManager(appBoxID);
//position after movement
draggedLeft = parseInt(draggedObj.style.left);
draggedTop = parseInt(draggedObj.style.top);
draggedWidth = parseInt(draggedObj.style.width);
draggedHeight = parseInt(draggedObj.style.height);
draggedLeftValue = draggedLeft;
draggedRightValue = draggedLeft + draggedWidth;
//position table indexes after the movement (the movement must fit a grid)
draggedLeftIndex = Math.floor((draggedLeft - divDayWidth-(divHourWidth/2))/divHourWidth) + 1;
draggedCalendarIndex = Math.floor((draggedTop - 130) / 240);
draggedTopIndex = Math.floor((draggedTop - 130 - 240 * draggedCalendarIndex - 3 * divDayHeight)/divDayHeight);
//May the box changes position? Think positive
newPlace = true;
//Is the box position
appRightValue = draggedLeft+draggedWidth;
calRightValue = parseInt($('div0_0_26').style.left)+parseInt($('div0_0_26').style.width)+ 0.5 * divHourWidth;;
if((draggedLeftIndex < 1) || (draggedLeftIndex > 26) || (draggedTopIndex < 1) || (draggedTopIndex > 7) || (appRightValue > calRightValue)){
newPlace = false;
}
//... Se non ci sono sovrapposizioni con appuntamenti giÓ presenti
for(indice = 0; indice < appNumber; indice = indice + 1){
curObj = appDivs[indice];
if(curObj != draggedObj){
firmLeft = parseInt(curObj.style.left);
firmTop = parseInt(curObj.style.top);
firmWidth = parseInt(curObj.style.width);
firmLeftValue = firmLeft;
firmRightValue = firmLeft + firmWidth;
firmCalendarIndex = Math.floor((firmTop - 130)/240);
firmTopIndex = Math.floor((firmTop - 130 - 240 * firmCalendarIndex - 3 * divDayHeight)/divDayHeight);
if((firmTopIndex == draggedTopIndex) && (firmCalendarIndex == draggedCalendarIndex)){
//if the new app and the old one are on the same row (day) of the same calendar I must check they are not overlapping
// +-----------+
// | FIRM +-----------+
// +----------| DRAGGED |
// +-----------+
if((draggedLeftValue > firmLeftValue) && (draggedLeftValue < firmRightValue)){
newPlace = false;
}
// +-----------+
// +-----------+ FIRM |
// | DRAGGED |---------+
// +-----------+
if((draggedRightValue > firmLeftValue) && (draggedRightValue < firmRightValue)){
newPlace = false;
}
}
}
}
if(newPlace == true){
//The new appointment sticks the closest empty element
divID = 'div'+draggedCalendarIndex+'_'+draggedTopIndex+'_'+draggedLeftIndex;
divObj = $(divID);
draggedObj.style.left = divObj.style.left;
draggedObj.style.top = divObj.style.top;
//New data
//New day
newDay = $('div'+draggedCalendarIndex+'_'+draggedTopIndex+'_0').getAttribute("name");
//New hour
newHour = $('div'+draggedCalendarIndex+'_0_'+draggedLeftIndex).getAttribute("name");
//New vet
newDoctor = doctorOfCalendarTables[draggedCalendarIndex];
//The same ID
idToModify = findAppId(draggedObj);
//pellif: To be tested
OL_draggedAppointmentUpdate(idToModify, newDoctor, newDay, newHour, {onSuccess: successInDraggingAppF, onFailure: failureInDraggingAppF});
}else{
//The new appointment is in a wrong place, it must return in the old position
draggedObj.style.left = dragStartLeft;
draggedObj.style.top = dragStartTop;
}
}
/***************************************** Drag & Drop ( END ) *****************************************/
/***************************/
/* Return the SCROLL value */
/***************************/
function getScrollY(){
var scroll = document.viewport.getScrollOffsets();
return scroll[1];
}
/*************************************************/
/* Manages click event on the tab client details */
/*************************************************/
function clickOnClientDetails(e){
if($('owner').value == '#'){
$('client').value=0;
manageNewClientDetails('client');
}
}
/*************************************/
/* Enable/disable new client details */
/*************************************/
function manageNewClientDetails(client){
var formObj = $('newclientDetails');
var heIsAnOldClient = parseInt($F(client));
if(heIsAnOldClient){
//disable all new client details input element (select included), all inputs value is now '#'
newClientDetailsFields.each(function(s){s.value='#';s.style.color='#BBBBBB';});
}else{
//enable all new client details input element (select included), all inputs value is now ''
newClientDetailsFields.each(function(s){s.value='';s.style.color='#000000';});
}
}
/**********************************/
/* Reloads the page on dateChange */
/**********************************/
function onDateChange(){
var dateText = $F('date');
var datePart = dateText.split("/");
var myDate = new Date(parseInt(datePart[2]), parseInt(datePart[1])-1, parseInt(datePart[0]));
var myDateSecs = myDate.getTime()/1000;
var mondaySecs = <?php echo mktime(0,0,0,$startMonth,$startDay,$startYear); ?>;
var sundaySecs = <?php echo mktime(0,0,0,$endMonth,$endDay,$endYear); ?>;
//alert(mondaySecs+'_'+myDateSecs+'_'+sundaySecs+'_(<?php echo $startDay."/".$startMonth."/".$startYear; ?>)_('+dateText+')_(<?php echo $endDay."/".$endMonth."/".$endYear; ?>)');
if((mondaySecs <= myDateSecs) && (myDateSecs <= sundaySecs)){
}else{
var aClientId = $F('client');
var aName = $F('owner');
var aTelephone = $F('telephone');
var anEmail = $F('email');
var aAddress = $F('address1');
var aVet = $F('vet');
var aLocation = $F('place');
var aDate = $F('date');
var aHour = $F('hour');
var aPeriod = $F('period');
var aComment = $F('note');
document.location.href='calendar.php?day='+datePart[0]+'&month='+datePart[1]+'&year='+datePart[2]+'&mai='+anEmail+'&cid='+aClientId+'&pro='+aName+'&tel='+aTelephone+'&cel=---&uff=---&add='+aAddress+'&vet='+aVet+'&loc='+aLocation+'&dat='+aDate+'&hou='+aHour+'&dur='+aPeriod+'&comm='+aComment;
}
}
/***********************************/
/* Manage the app box just created */
/***********************************/
function successInCreatingAppF(transport){
var newAppObj;
var place;
var args=transport.responseText.evalJSON();
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
//success in creating request
if(parseInt(args.opResult) == 0){
//success in creating app box
place = num2Place(parseInt(args.aPlace));
newAppObj = createNewAppBox(place, args.appId, parseInt(args.aCalendar), args.aDay, args.anHour, args.aPeriod, appNumber);
appOnLoad(newAppObj);
}else{
//failure in creating app box
}
}
/*****************************************/
/* Failure in creating request to server */
/*****************************************/
function failureInCreatingAppF(){
alert('<?php echo _T("NI_calendar_") ?>');
}
/****************************************/
/* Checks infos and creates appointment */
/****************************************/
function createNewApp(){
var isAnOldClient = parseInt($F('client'));
var aClient = $F('client');
var aNote = $F('note');
var aDate = $F('date');
var anHour = $F('hour');
var aPeriod = $F('period');
var aVet = $F('vet');
var aOwner = $F('owner');
var aTelephone = $F('telephone');
var anAddress = $F('address1');
var anEmail = $F('email');
var aPlace;
aPlace = place2Num($F('place'));
if(isAnOldClient){
OL_createNewAppointment(aClient, aOwner, aTelephone, anEmail, anAddress, aVet, aPlace, aDate, anHour, aPeriod, aNote, {onSuccess: successInCreatingAppF, onFailure: failureInCreatingAppF});
}else{
if(formValidationRules.validate()){
OL_createNewAppointment(aClient, aOwner, aTelephone, anEmail, anAddress, aVet, aPlace, aDate, anHour, aPeriod, aNote, {onSuccess: successInCreatingAppF, onFailure: failureInCreatingAppF});
}else{
alert('<?php echo _T("NI_calendar_") ?>');
}
}
}
/************************************************/
/* Find out the appointment ID from the element */
/************************************************/
function findAppId(appElem){
var args = $(appElem).getAttribute("name").split("_");
var appId = args[0];
return appId;
}
/************************************/
/* Link to appointment details page */
/************************************/
function showAppDetails(elem){
document.location.href='viewAppointmentDetails.php?appointmentID='+findAppId($(elem));
}
/****************************************/
/* Manages and shows boxes context menu */
/****************************************/
function showContextMenu(e, element) {
contextMenuObj = $('contextMenu');
pasteObj = $('paste');
copyObj = $('copy');
cancelObj = $('cancel');
cutObj = $('cut');
srcObj = $(element);
if(($(srcObj).getAttribute("class") == 'visitAppBox') || ($(srcObj).getAttribute("class") == 'homeVisitAppBox') || ($(srcObj).getAttribute("class") == 'extCommitmentAppBox') || ($(srcObj).getAttribute("class") == 'holidayAppBox')){
//visitAppBox OR homeVisitAppBox OR extCommitmentAppBox OR holidayAppBox
contextMenuObj.style.left = e.pointerX()+'px';
contextMenuObj.style.top = e.pointerY()+'px';
contextMenuObj.style.visibility = 'visible';
cutObj.style.color = "darkblue";
copyObj.style.color = "darkblue";
pasteObj.style.color = "gray";
cancelObj.style.color = "darkblue";
}
if($(srcObj).getAttribute("class") == 'emptyAppBox'){
//emptyAppBox
contextMenuObj.style.left = e.pointerX()+'px';
contextMenuObj.style.top = e.pointerY()+'px';
contextMenuObj.style.visibility = 'visible';
cutObj.style.color = "gray";
copyObj.style.color = "gray";
if(thereIsAnAppointmentToBeCopied){
pasteObj.style.color = "darkblue";
}else{
pasteObj.style.color = "gray";
}
cancelObj.style.color = "gray";
}
}
/***********************************/
/* Manages boxes select operations */
/***********************************/
function selectionManager(divObj){
if(selectedBox){
selectThis(selectedBox, false);
}
selectedBox = divObj;
selectThis(selectedBox, true);
}
/***********************************/
/* Select/Deselect visual features */
/***********************************/
function selectThis(divObj, cond){
var newColor;
var box = $(divObj);
var getDivClass = box.getAttribute("class");
switch(getDivClass){
case 'visitAppBox':
if(cond){newColor = '#C06C80';}else{newColor = '#FF90AA';}
break;
case 'homeVisitAppBox':
if(cond){newColor = '#303093';}else{newColor = '#5555FF';}
break;
case 'extCommitmentAppBox':
if(cond){newColor = '#C0A92A';}else{newColor = '#FFE138';}
break;
case 'holidayAppBox':
if(cond){newColor = '#009171';}else{newColor = '#00C196';}
break;
case 'emptyAppBox':
if(cond){newColor = '#DDDCFA';}else{newColor = '#FFFEFA';}
break;
default:
}
box.style.backgroundColor = newColor;
}
function successInRetrivingInfoF(transport){
var args=transport.responseText.evalJSON();
var isAClient = parseInt(args.client);
var place;
//Success in retrive request
//I want show the operation result advice only if the retrive operation fails
if(parseInt(args.opResult) == 0){
//Success in retrive operation
$('client').value = args.client;
manageNewClientDetails('client');
if(!(isAClient)){ //If he is not a client I must show all the details
$('owner').value = args.owner;
$('telephone').value = args.telephone;
$('email').value = args.email;
$('address1').value = args.address1;
}
$('vet').value = args.vet;
place = num2Place(parseInt(args.place));
$('place').value = place;
$('date').value = args.date;
$('hour').value = args.hour;
$('period').value = args.period;
$('note').value = args.note;
}else{
//Failure in retrive operation
//Operation result advice
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
}
}
function failureInRetrivingInfoF(){
//Failure in retrive request
}
/****************************************/
/* Manages mousedown event on the table */
/****************************************/
function clickOnTable(e, tagToFind){
srcObj = e.findElement(tagToFind);
if(e.isLeftClick()){
/***********************************/
/* Left click detected (prototype) */
/***********************************/
selectionManager(srcObj);
if(($(srcObj).getAttribute("class") == 'visitAppBox') || ($(srcObj).getAttribute("class") == 'homeVisitAppBox') || ($(srcObj).getAttribute("class") == 'extCommitmentAppBox') || ($(srcObj).getAttribute("class") == 'holidayAppBox')){
OL_retriveAppointmentInfos(findAppId($(srcObj)), {onSuccess: successInRetrivingInfoF, onFailure: failureInRetrivingInfoF});
}
if($(srcObj).getAttribute("class") == 'emptyAppBox'){
divIdParts = srcObj.getAttribute("id").split("_");
calendar = parseInt(divIdParts[0].replace("div",""));
indDay = parseInt(divIdParts[1]);
newDate = $('div'+calendar+'_'+indDay+'_0').getAttribute("name");
$('date').value = newDate;
}
}else if(e.isMiddleClick()){
/*************************************/
/* Middle click detected (prototype) */
/*************************************/
alert('Middle');
}else if(e.isRightClick()){
/************************************/
/* Right click detected (prototype) */
/************************************/
selectionManager(srcObj);
showContextMenu(e, srcObj);
}else{
alert('Other: '+e.button);
}
e.stop();
}
/****************************************/
/* Manages mousedown event on the table */
/****************************************/
function onResizing(el){
var elWidth = parseInt($(el).style.width);
var elLeft = parseInt($(el).style.left);
var elTop = parseInt($(el).style.top);
var calRight = parseInt($('div0_0_26').style.left)+parseInt($('div0_0_26').style.width);
var newWidth;
//within calendars borders
if(elWidth+elLeft > calRight){
newWidth = calRight - elLeft;
el.style.width = newWidth+'px';
}
//app box calendar index
leftIndex = Math.floor((elLeft - divDayWidth-(divHourWidth/2))/divHourWidth) + 1;
calendarIndex = Math.floor((elTop - 130) / 240);
topIndex = Math.floor((elTop - 130 - 240 * calendarIndex - 3 * divDayHeight)/divDayHeight);
//for each app box in calendar...
for(indice = 0; indice < appNumber; indice = indice + 1){
curObj = appDivs[indice];
//...all app boxes except the one we are resizing
if(curObj != el){
cLeftV = parseInt(curObj.style.left);
cTopV = parseInt(curObj.style.top);
cWidthV = parseInt(curObj.style.width);
cHeightV = parseInt(curObj.style.height);
cCalendarIndex = Math.floor((cTopV - 130)/240);
cTopIndex = Math.floor((cTopV - 130 - 240 * cCalendarIndex - 3 * divDayHeight)/divDayHeight);
//if in the same row of the same calendar
if((cTopIndex == topIndex) && (cCalendarIndex == calendarIndex) && (elLeft < cLeftV)){
if(elLeft+elWidth > cLeftV){
// |
// |<-limit
// |
// +------------+ |-----------+
// | RESIZING | | APP BOX |
// +------------+ +-----------+
newWidth = cLeftV - elLeft - 1;
el.style.width = newWidth+'px';
}
}
}
}
}
/********************************************************/
/* Manages update result caused by the resize operation */
/********************************************************/
function successInResizingAppF(transport){
var args=transport.responseText.evalJSON();
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
//Success in resize request
if(parseInt(args.opResult) == 0){
//Success in resize operation
}else{
//Error during resize operation
}
}
/**********************************************************/
/* Manages request failure caused by the resize operation */
/**********************************************************/
function failureInResizingAppF(){
//Failure in resize request
alert('<?php echo _T("NI_calendar_") ?>');
}
/*******************************************/
/* Manages the end of the resize operation */
/*******************************************/
function resizeEnd(el){
var idToModify = findAppId($(el));
var newTimeTo = ((parseInt($(el).style.width) - divHourWidth) / (divHourWidth+1)) * 30 + 30;
OL_resizedAppointmentUpdate(idToModify, newTimeTo, {onSuccess: successInResizingAppF, onFailure: failureInResizingAppF});
}
/**********************************************************/
/* Manages update result caused by the cut&copy operation */
/**********************************************************/
function successInCopyAndCutOperationF(transport){
var args=transport.responseText.evalJSON();
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
}
/************************************************************/
/* Manages request failure caused by the cut&copy operation */
/************************************************************/
function failureInCopyAndCutOperationF(){
alert('<?php echo _T("NI_calendar_") ?>');
}
/*****************/
/* Cut operation */
/*****************/
function cutFn(){
$('contextMenu').style.visibility = 'hidden';
if($(selectedBox).getAttribute('class') != 'emptyAppBox'){
thereIsAnAppointmentToBeCopied = CUT_OPERATION;
OL_appointmentCut(findAppId($(selectedBox)), '1', {onSuccess: successInCopyAndCutOperationF, onFailure: failureInCopyAndCutOperationF});
}
}
/******************/
/* Copy operation */
/******************/
function copyFn(){
$('contextMenu').style.visibility = 'hidden';
if($(selectedBox).getAttribute('class') != 'emptyAppBox'){
thereIsAnAppointmentToBeCopied = COPY_OPERATION;
OL_appointmentCopy(findAppId($(selectedBox)), '2', {onSuccess: successInCopyAndCutOperationF, onFailure: failureInCopyAndCutOperationF});
}
}
/*******************************************************/
/* Manages update result caused by the paste operation */
/*******************************************************/
function successInPasteOperationF(transport){
var newAppObj;
var args=transport.responseText.evalJSON();
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
newAppObj = createNewAppBox(num2Place(parseInt(args.place)), args.appId, parseInt(args.aCalendar), args.aDay, args.anHour, args.aPeriod, appNumber);
appOnLoad(newAppObj);
if(thereIsAnAppointmentToBeCopied == CUT_OPERATION){
//Cut operation
thereIsAnAppointmentToBeCopied = NO_OPERATION;
//for each app box in the page minus the pasted one
for(indice = 0; indice < appNumber-1; indice = indice + 1){
curObj = appDivs[indice];
//If a box has the same ID of the pasted box, then is the app box we have to cut
if(findAppId(curObj) == args.appId){
curObj.style.display = 'none';
}
}
}
}else{
//Error during paste operation
}
}
/*********************************************************/
/* Manages request failure caused by the paste operation */
/*********************************************************/
function failureInPasteOperationF(){
alert('<?php echo _T("NI_calendar_") ?>');
}
/***********************/
/* The paste operation */
/***********************/
function pasteFn(){
var emptyDiv = $(selectedBox);
var newAppNumber = appNumber + 1;
$('contextMenu').style.visibility = 'hidden';
if(($(selectedBox).getAttribute('class') == 'emptyAppBox') && (thereIsAnAppointmentToBeCopied != NO_OPERATION)){
/* **************************************************************************** */
/* Calcolo i parametri temporali e il veterianrio da associare al nuovo - Start */
/* **************************************************************************** */
//tutti gli altri parametri verranno mutuati dall'appuntamento copiato o tagliato
divIdParts = emptyDiv.getAttribute("id").split("_");
calendar = parseInt(divIdParts[0].replace("div",""));
newDoctor = doctorOfCalendarTables[calendar];
indDay = parseInt(divIdParts[1]);
resto = (parseInt(divIdParts[2])-1)%2;
indTime = 8 + ((parseInt(divIdParts[2])-1) - resto)/2
if(resto == 1){
startTime = indTime+':30';
}else{
startTime = indTime+':00';
}
newDate = $('div'+calendar+'_'+indDay+'_0').getAttribute("name");
/* ************************************************************************** */
/* Calcolo i parametri temporali e il veterianrio da associare al nuovo - End */
/* ************************************************************************** */
OL_appointmentPaste(startTime, newDate, newDoctor, calendar, indDay, newAppNumber, {onSuccess:successInPasteOperationF, onFailure:failureInPasteOperationF});
}
}
/********************************************************/
/* Manages delete result caused by the cancel operation */
/********************************************************/
function successInDeletingApp(transport){
var args=transport.responseText.evalJSON();
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
$(selectedBox).style.display = 'none';
}else{
//Error during paste operation
}
}
/**********************************************************/
/* Manages request failure caused by the cancel operation */
/**********************************************************/
function failureInDeletingApp(){
alert('<?php echo _T("NI_calendar_") ?>');
}
/************************/
/* The cancel operation */
/************************/
function cancelFn(){
appId = findAppId(selectedBox);
$('contextMenu').style.visibility = 'hidden';
if($(selectedBox).getAttribute('class') != 'emptyAppBox'){
thereIsAnAppointmentToBeCopied = NO_OPERATION;
OL_deleteAppointment(appId, {onSuccess: successInDeletingApp, onFailure: failureInDeletingApp});
}
}
/******************************/
/* Create New app box */
/******************************/
/* main div */
/* | */
/* +----------------+ */
/* |O :| */
/* +----------------+ */
/* | | */
/* hdrag&drop hresize */
/* ******************************/
function createNewAppBox(appType, appId, appCalendar, appDay, appTime, appDuration, appNumber){
var commonObject;
var mainDiv;
var ddHandleSpan;
var ddHandleImage;
var rHandleSpan;
var rHandleImage;
var classStr;
//alert(appType+'_'+appId+'_'+appCalendar+'_'+appDay+'_'+appTime+'_'+appDuration+'_'+appNumber);
//Main div
mainDiv = document.createElement("div");
mainDiv.setAttribute("class", appType);
mainDiv.setAttribute("id",'app'+appNumber);
mainDiv.setAttribute("name", appId+'_'+appCalendar+'_'+appDay+'_'+appTime+'_'+appDuration+'_'+appNumber);
document.getElementById('calendarCol').appendChild(mainDiv);
//Drag and drop span
ddHandleSpan = document.createElement("span");
ddHandleSpan.setAttribute("id",'span1app'+appNumber);
ddHandleSpan.setAttribute("class",'handle1');
mainDiv.appendChild(ddHandleSpan);
//Handle drag and drop
ddHandleImage = document.createElement("img");
ddHandleImage.setAttribute("src", "images/handle.png");
ddHandleSpan.appendChild(ddHandleImage);
//Span contenente l'handle resize
rHandleSpan = document.createElement("span");
rHandleSpan.setAttribute("id",'span2app'+appNumber);
rHandleSpan.setAttribute('style', 'float: right');
mainDiv.appendChild(rHandleSpan);
//Handle resize
rHandleImage = document.createElement("img");
rHandleImage.setAttribute("src", "images/handleResize.png");
rHandleSpan.appendChild(rHandleImage);
classStr ='div.'+appType;
$$(classStr).each(function(s){Event.observe(s,'dblclick',function(e){showAppDetails(s);})});
$$(classStr).each(function(s){Event.observe(s,'mousedown',function(e){Event.stop(e); clickOnTable(e, 'div');})});
return mainDiv;
}
//handler for keypressed event
//UNUSED - I'm not able to detect CTRL-C.
//To enable this function de-comment its
//"observe" row in the load event observer
//at the end of the page
function detectKeyPressed(e){
var unicode;
//These are for cross-browser compatibility
if(!e){e = window.event;}
if(e.keyCode){unicode = e.keyCode;}else{unicode = e.charCode;}
switch(unicode){
case 46:/* CANCEL */ break;
case 67:/* C */ if (e.ctrlKey){/* CTRL-C */} break;
case 22:/* V */ if (e.ctrlKey){/* CTRL-V */} break;
case 24:/* X */ if (e.ctrlKey){/* CTRL-X */} break;
default:/* c */
}
}
/***************************************************************************************/
/* Set the event handler and the init functions for all the item in the calendar table */
/***************************************************************************************/
function setCalendarEventHandlers(){
<?php
$calendar=0;
mysql_query("BEGIN");
$getDoctors = mysql_query("SELECT * FROM users WHERE userPrivList='Dottore' ORDER BY userFullName");
while($row = mysql_fetch_array($getDoctors)) {
$row[userFullName];
echo "calendarOnLoad('" . $calendar . "', '" . $row[userFullName] . "');\n";
$calendar=$calendar+1;
}
mysql_query("COMMIT");
?>
$$('div.visitAppBox').each( function(s){appOnLoad(s);});
$$('div.homeVisitAppBox').each( function(s){appOnLoad(s);});
$$('div.extCommitmentAppBox').each( function(s){appOnLoad(s);});
$$('div.holidayAppBox').each( function(s){appOnLoad(s);});
$$('div.visitAppBox').each( function(s){Event.observe(s,'dblclick',function(e){showAppDetails(s);})});
$$('div.homeVisitAppBox').each( function(s){Event.observe(s,'dblclick',function(e){showAppDetails(s);})});
$$('div.extCommitmentAppBox').each( function(s){Event.observe(s,'dblclick',function(e){showAppDetails(s);})});
$$('div.holidayAppBox').each( function(s){Event.observe(s,'dblclick',function(e){showAppDetails(s);})});
$$('div.emptyAppBox').each( function(s){Event.observe(s,'mousedown',function(e){Event.stop(e); clickOnTable(e, 'div');})});
$$('div.visitAppBox').each( function(s){Event.observe(s,'mousedown',function(e){Event.stop(e); clickOnTable(e, 'div');})});
$$('div.homeVisitAppBox').each( function(s){Event.observe(s,'mousedown',function(e){Event.stop(e); clickOnTable(e, 'div');})});
$$('div.extCommitmentAppBox').each( function(s){Event.observe(s,'mousedown',function(e){Event.stop(e); clickOnTable(e, 'div');})});
$$('div.holidayAppBox').each( function(s){Event.observe(s,'mousedown',function(e){Event.stop(e); clickOnTable(e, 'div');})});
}
</script>
<?php
?>
<div id="qResult" class="OpResult"></div>
<div class="Columns">
<div class="Column1">
<!-- *********************************************************** -->
<!-- * Appointment tab * -->
<!-- *********************************************************** -->
<div class="Block" style="position:fixed; width:19%"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><div class="BlockContentBorder">
<form id="formToValidate">
<table width="100%">
<tr>
<td width="10%"><b><?php echo _T("Client") ?></b></td>
<td colspan="4">
<select name="client" id="client" style="width: 98%;" >
<option value="0"></option>
<?php
mysql_query("BEGIN");
$clientList= mysql_query("SELECT * FROM clients ORDER BY clientName");
while($row = mysql_fetch_array($clientList)) {
if($aClient == $row[clientID]){
echo "<option value=\"" . $row[clientID] . "\" selected=\"selected\">" . $row[clientName] . " " . $row[clientSurname] . "</option>";
}else{
echo "<option value=\"" . $row[clientID] . "\">" . $row[clientName] . " " . $row[clientSurname] . "</option>";
}
}
mysql_query("COMMIT");
?>
</select>
</td>
</tr>
<tr>
<td><?php echo _T("Name") ?></td>
<?php
echo "<td colspan=\"4\"><input class=\"required\" type=\"text\" style=\"width: 93%;\" id=\"owner\" name=\"owner\" value=\"" . $aName . "\"></td>";
?>
</tr>
<tr>
<td><?php echo _T("Telephone") ?></td>
<?php
echo "<td colspan=\"4\"><input class=\"validate-number\" type=\"text\" style=\"width: 93%;\" id=\"telephone\" name=\"telephone\" value=\"" . $aTelephone . "\"></td>";
?>
</tr>
<tr>
<td><?php echo _T("Email") ?></td>
<?php
echo "<td colspan=\"4\"><input class=\"validate-email\" type=\"text\" style=\"width: 93%;\" id=\"email\" name=\"email\" value=\"" . $anEmail . "\"></td>";
?>
</tr>
<tr>
<td><?php echo _T("Address") ?></td>
<?php
echo "<td colspan=\"4\"><input type=\"text\" style=\"width: 93%;\" id=\"address1\" name=\"address1\" value=\"" . $aAddress . "\"></td>";
?>
</tr>
<tr>
<td><b><?php echo _T("Vet") ?></b></td>
<td colspan="4">
<select style="width: 98%;" id="vet" name="vet">
<?php
mysql_query("BEGIN");
$vetList=mysql_query("SELECT * FROM users WHERE userPrivList='Dottore' ORDER BY userFullName");
while($row = mysql_fetch_array($vetList)) {
if($aVet == $row[userFullName]){
echo "<option value=\"" . $row[userFullName] . "\" selected=\"selected\">" . $row[userFullName] . "</option>";
}else{
echo "<option value=\"" . $row[userFullName] . "\">" . $row[userFullName] . "</option>";
}
}
mysql_query("COMMIT");
?>
</select>
</td>
</tr>
<tr>
<td><b><?php echo _T("Place") ?></b></td>
<td colspan="4">
<select style="width: 98%;" id="place" name="place">
<?php
if($aLocation == 0){
echo "<option value=\"visitAppBox\" selected=\"selected\">" . _T("Clinic visit") . "</option>";
}else{
echo "<option value=\"visitAppBox\">" . _T("Clinic visit") . "</option>";
}
if($aLocation == 1){
echo "<option value=\"homeVisitAppBox\" selected=\"selected\">" . _T("Home visit") . "</option>";
}else{
echo "<option value=\"homeVisitAppBox\">" . _T("Home visit") . "</option>";
}
if($aLocation == 2){
echo "<option value=\"extCommitmentAppBox\" selected=\"selected\">" . _T("External commitment") . "</option>";
}else{
echo "<option value=\"extCommitmentAppBox\">" . _T("External commitment") . "</option>";
}
if($aLocation == 3){
echo "<option value=\"holidayAppBox\" selected=\"selected\">" . _T("Holiday") . "</option>";
}else{
echo "<option value=\"holidayAppBox\">" . _T("Holiday") . "</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td width="10%"><b><?php echo _T("Date") ?></b></td>
<td colspan="3"><input style="width:95%;" type="text" readonly="readonly" id="date" value="<?php echo $oDay . "/" . $oMonth . "/" . $oYear; ?>"></td><td width="10%" align="right"><a href="javascript:calendarLoad('date');"><img src="./images/calendarIcon.png"/></a></td></tr>
</tr>
<tr>
<td><b><?php echo _T("Hour") ?></b></td>
<td colspan="4"><select id="hour" style="width:40%;" name="hour"><?php $conta=8; while($conta<21){$oraApp=$conta . ":00"; echo "<option value=\"" . $oraApp . "\">" . $oraApp . "</option>"; $oraApp=$conta . ":30"; echo "<option value=\"" . $oraApp . "\">" . $oraApp . "</option>"; $conta=$conta+1;} ?></select>(<select id="period" style="width:35%" name="period"><?php $durata=0; while($durata<780){$durata=$durata+30; $hourCheck = $durata%60; if($hourCheck != 0){$hourToDisplay = ($durata - 30)/60; $hourToDisplay = $hourToDisplay . ":30";}else{$hourToDisplay = $durata/60; $hourToDisplay = $hourToDisplay . ":00";} if($durata!=30){echo "<option value=\"" . $durata . "\">" . $hourToDisplay . "</option>";}else{echo "<option selected=\"selected\" value=\"" . $durata . "\">" . $hourToDisplay . "</option>";}} ?></select>min)</td>
</tr>
<tr>
<td colspan="5"><b><?php echo _T("Note") ?></b></td>
</tr>
<tr valign="top">
<td colspan="5"><textarea rows="4" cols="1" id="note" name="note" style="font-size:1em; width:95%;"><?php echo $aComment; ?></textarea></td>
</tr>
<tr>
<td colspan="5" align="center"><input type="button" id="createNewApp" value="<?php echo _T("New appointment") ?>"></td>
</tr>
</table>
</form>
</div>
</div>
</div>
<div><p style="color:#FFFEFA;">p</div>
</div>
<div id="calendarCol" class="MainColumn">
<!-- *********************************************************** -->
<!-- * Calendar table * -->
<!-- *********************************************************** -->
<div id="calendarTable" style="height: 1px">
</div>
<!-- *********************************************************** -->
<!-- * Hidden context menu * -->
<!-- *********************************************************** -->
<div id="contextMenu" this.tid=setTimeout('menu.style.visibility = \'hidden\'', 20);" style="position:absolute; z-index: 5;">
<a href="#" id="cut" class="cmMenuOff" ><?php echo _T("Cut") ?></a><br>
<a href="#" id="copy" class="cmMenuOff" ><?php echo _T("Copy") ?></a><br>
<a href="#" id="paste" class="cmMenuOff" ><?php echo _T("Paste") ?></a><br>
<a href="#" id="cancel" class="cmMenuOff" ><?php echo _T("Cancel") ?></a>
</div>
</div>
</div>
<script>
// ************************************************************
// * Observe window load event to call the init page function *
// ************************************************************
Event.observe(window, 'load', function(){
// ******************************************
// * Load calendar table for the first time *
// ******************************************
OL_calendarTableLoad(<?php echo $startDay; ?>, <?php echo $startMonth; ?>, <?php echo $startYear; ?>,{elementToFill: 'calendarTable', onSuccess: setCalendarEventHandlers});
// ******************
// * Variables init *
// ******************
newClientDetailsFields = new Array($('owner'), $('telephone'), $('email'), $('address1'));
// **************************
// * Install event handlers *
// **************************
//Event.observe(document, 'keypress', function(e){detectKeyPressed(e);});
//Manage the appointment TAB events
Event.observe('client', 'change', function(e){manageNewClientDetails('client');});
Event.observe('owner', 'click', function(e){Event.stop(e); clickOnClientDetails(e);});
Event.observe('telephone', 'click', function(e){Event.stop(e); clickOnClientDetails(e);});
Event.observe('email', 'click', function(e){Event.stop(e); clickOnClientDetails(e);});
Event.observe('address1', 'click', function(e){Event.stop(e); clickOnClientDetails(e);});
Event.observe('date', 'dateChoice:newDateSet', function(e){onDateChange();});
Event.observe('createNewApp', 'click', function(e){createNewApp();});
//Result bar behavior
Event.observe('qResult', 'mouseover', function(){OL_makeThisElementInvisible('qResult');});
//Prevent default context menu
Event.observe(document,'contextmenu',function(e){e.stop();});
//Manage the new context menu
Event.observe('cut', 'click', function(e){cutFn()});
Event.observe('copy', 'click', function(e){copyFn()});
Event.observe('paste', 'click', function(e){pasteFn()});
Event.observe('cancel', 'click', function(e){cancelFn()});
// *********************
// * Install validator *
// *********************
formValidationRules = new Validation('formToValidate',{immediate:true, onSubmit:false, useTitles:true, stopOnFirst:false});
//alert('<?php echo $startDay?>/<?php echo $startMonth?>/<?php echo $startYear?> --> <?php echo $endDay?>/<?php echo $endMonth?>/<?php echo $endYear?>');
});
</script>
<!-- tags opened in the header -->
</div>
</div>
</div>
</body>
</html>