forked from ronisaha/wdCalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.php
291 lines (262 loc) · 11.2 KB
/
sample.php
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<title> My Calendar </title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link href="css/dailog.css" rel="stylesheet" type="text/css" />
<link href="css/calendar.css" rel="stylesheet" type="text/css" />
<link href="css/dp.css" rel="stylesheet" type="text/css" />
<link href="css/alert.css" rel="stylesheet" type="text/css" />
<link href="css/main.css" rel="stylesheet" type="text/css" />
<script src="src/jquery.js" type="text/javascript"></script>
<script src="src/Plugins/Common.js" type="text/javascript"></script>
<script src="src/Plugins/datepicker_lang_US.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.datepicker.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.alert.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.ifrmdailog.js" defer="defer" type="text/javascript"></script>
<script src="src/Plugins/wdCalendar_lang_US.js" type="text/javascript"></script>
<script src="src/Plugins/jquery.calendar.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var view="week";
var DATA_FEED_URL = "php/datafeed.php";
var op = {
view: view,
theme:3,
showday: new Date(),
EditCmdhandler:Edit,
DeleteCmdhandler:Delete,
ViewCmdhandler:View,
onWeekOrMonthToDay:wtd,
onBeforeRequestData: cal_beforerequest,
onAfterRequestData: cal_afterrequest,
onRequestDataError: cal_onerror,
autoload:true,
url: DATA_FEED_URL + "?method=list",
quickAddUrl: DATA_FEED_URL + "?method=add",
quickUpdateUrl: DATA_FEED_URL + "?method=update",
quickDeleteUrl: DATA_FEED_URL + "?method=remove"
};
var $dv = $("#calhead");
var _MH = document.documentElement.clientHeight;
var dvH = $dv.height() + 2;
op.height = _MH - dvH;
op.eventItems =[];
var p = $("#gridcontainer").bcalendar(op).BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
$("#caltoolbar").noSelect();
$("#hdtxtshow").datepicker({ picker: "#txtdatetimeshow", showtarget: $("#txtdatetimeshow"),
onReturn:function(r){
var p = $("#gridcontainer").gotoDate(r).BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
}
});
function cal_beforerequest(type)
{
var t="Loading data...";
switch(type)
{
case 1:
t="Loading data...";
break;
case 2:
case 3:
case 4:
t="The request is being processed ...";
break;
}
$("#errorpannel").hide();
$("#loadingpannel").html(t).show();
}
function cal_afterrequest(type)
{
switch(type)
{
case 1:
$("#loadingpannel").hide();
break;
case 2:
case 3:
case 4:
$("#loadingpannel").html("Success!");
window.setTimeout(function(){ $("#loadingpannel").hide();},2000);
break;
}
}
function cal_onerror(type,data)
{
$("#errorpannel").show();
}
function Edit(data)
{
var eurl="edit.php?id={0}&start={2}&end={3}&isallday={4}&title={1}";
if(data)
{
var url = StrFormat(eurl,data);
OpenModelWindow(url,{ width: 600, height: 400, caption:"Manage The Calendar",onclose:function(){
$("#gridcontainer").reload();
}});
}
}
function View(data)
{
var str = "";
$.each(data, function(i, item){
str += "[" + i + "]: " + item + "\n";
});
alert(str);
}
function Delete(data,callback)
{
$.alerts.okButton="Ok";
$.alerts.cancelButton="Cancel";
hiConfirm("Are You Sure to Delete this Event", 'Confirm',function(r){ r && callback(0);});
}
function wtd(p)
{
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
$("#caltoolbar div.fcurrent").each(function() {
$(this).removeClass("fcurrent");
})
$("#showdaybtn").addClass("fcurrent");
}
//to show day view
$("#showdaybtn").click(function(e) {
//document.location.href="#day";
$("#caltoolbar div.fcurrent").each(function() {
$(this).removeClass("fcurrent");
})
$(this).addClass("fcurrent");
var p = $("#gridcontainer").swtichView("day").BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
});
//to show week view
$("#showweekbtn").click(function(e) {
//document.location.href="#week";
$("#caltoolbar div.fcurrent").each(function() {
$(this).removeClass("fcurrent");
})
$(this).addClass("fcurrent");
var p = $("#gridcontainer").swtichView("week").BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
});
//to show month view
$("#showmonthbtn").click(function(e) {
//document.location.href="#month";
$("#caltoolbar div.fcurrent").each(function() {
$(this).removeClass("fcurrent");
})
$(this).addClass("fcurrent");
var p = $("#gridcontainer").swtichView("month").BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
});
$("#showreflashbtn").click(function(e){
$("#gridcontainer").reload();
});
//Add a new event
$("#faddbtn").click(function(e) {
var url ="edit.php";
OpenModelWindow(url,{ width: 500, height: 400, caption: "Create New Calendar"});
});
//go to today
$("#showtodaybtn").click(function(e) {
var p = $("#gridcontainer").gotoDate().BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
});
//previous date range
$("#sfprevbtn").click(function(e) {
var p = $("#gridcontainer").previousRange().BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
});
//next date range
$("#sfnextbtn").click(function(e) {
var p = $("#gridcontainer").nextRange().BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
});
});
</script>
</head>
<body>
<div>
<div id="calhead" style="padding-left:1px;padding-right:1px;">
<div class="cHead"><div class="ftitle">My Calendar</div>
<div id="loadingpannel" class="ptogtitle loadicon" style="display: none;">Loading data...</div>
<div id="errorpannel" class="ptogtitle loaderror" style="display: none;">Sorry, could not load your data, please try again later</div>
</div>
<div id="caltoolbar" class="ctoolbar">
<div id="faddbtn" class="fbutton">
<div><span title='Click to Create New Event' class="addcal">
New Event
</span></div>
</div>
<div class="btnseparator"></div>
<div id="showtodaybtn" class="fbutton">
<div><span title='Click to back to today ' class="showtoday">
Today</span></div>
</div>
<div class="btnseparator"></div>
<div id="showdaybtn" class="fbutton">
<div><span title='Day' class="showdayview">Day</span></div>
</div>
<div id="showweekbtn" class="fbutton fcurrent">
<div><span title='Week' class="showweekview">Week</span></div>
</div>
<div id="showmonthbtn" class="fbutton">
<div><span title='Month' class="showmonthview">Month</span></div>
</div>
<div class="btnseparator"></div>
<div id="showreflashbtn" class="fbutton">
<div><span title='Refresh view' class="showdayflash">Refresh</span></div>
</div>
<div class="btnseparator"></div>
<div id="sfprevbtn" title="Prev" class="fbutton">
<span class="fprev"></span>
</div>
<div id="sfnextbtn" title="Next" class="fbutton">
<span class="fnext"></span>
</div>
<div class="fshowdatep fbutton">
<div>
<input type="hidden" name="txtshow" id="hdtxtshow" />
<span id="txtdatetimeshow">Loading</span>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div style="padding:1px;">
<div class="t1 chromeColor">
</div>
<div class="t2 chromeColor">
</div>
<div id="dvCalMain" class="calmain printborder">
<div id="gridcontainer" style="overflow-y: visible;">
</div>
</div>
<div class="t2 chromeColor">
</div>
<div class="t1 chromeColor">
</div>
</div>
</div>
</body>
</html>