This repository has been archived by the owner on Nov 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhome.php
100 lines (74 loc) · 2.61 KB
/
home.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
<?php
require_once dirname(__FILE__).'/includes/common.php';
/* Automatically redirects to index.php if not logged in. */
if(LOGGED_IN == false){
header("Location: index.php");
}
$display_name = str_replace("twitter.", "[twitter] ",$_SESSION['user_id']);
loadHeader("Hello, ".$display_name);
?>
<script type="text/javascript">
$(document).ready(function(){
$('#new_e_title').val('').focus();
$.post('ajax.php',function(response){
$('.event_container').html(response);
});
$('.event_drop').live('click',function(){
var eventId = $(this).attr('rel');
//alert(eventId);
/* AJAX to remove the event from db*/
$(this).parent().fadeOut(500,function(){
$.post('ajax.php',{remove_event_id: eventId},function(response){
$('.event_container').html(response);
});
});
return false;
});
$('.event_change_status').live('click',function(){
var eventId = $(this).attr('rel');
//alert(eventId);
/* AJAX to remove the event from db*/
$.post('ajax.php',{update_event_id: eventId},function(response){
$('.event_container').html(response);
});
return false;
});
$('#event_add').submit(function(){
var event_title = $('#new_e_title').val();
var event_desc = $('#new_e_desc').val();
if((event_title.length < 3 || event_desc.length < 3) || (event_title.length > 50 || event_desc.length > 100)){
$.jqDialog.notify("<p align='left'>Only [3 to 50] characters allowed for Task Title.<br/>"
+"Only [3 to 100] characters allowed for Task Description.</p>", 3);
return false;
}
$.jqDialog.notify("Please wait");
/* AJAX to add event to db*/
$.post('ajax.php',{ e_title: event_title, e_desc: event_desc },function(response){
//alert("add event"+response);
$('.event_container').html(response);
$.jqDialog.close();
$('#new_e_title').val('').focus();
$('#new_e_desc').val('');
});
return false;
});
});
</script>
<div id="header">
<p class="user_info"><?php echo $display_name; ?> <a href="login.php?logout=1" class="logout button">Log out</a></p>
<h3 class="today"><?php echo date('l, d M Y'); ?></h3>
<form id="event_add" method="post" action="">
<label>New Task Title </label><input type="text" id="new_e_title" maxlength="50" />
<label> Task Description </label><input type="text" id="new_e_desc" maxlength="100" />
<input type="submit" value="Add" class="button" />
<div class="clear"></div>
</form>
</div>
<div class="clear"></div>
<div class="event_container">
</div> <!-- event container -->
<div class="clear"> </div>
<p class="credit"><a href="">Simple ToDo List,</a> By Kamaleshwar</p>
<?php
loadFooter();
?>