Use AJAX for calendar initialization
This commit is contained in:
parent
7e3fa85a00
commit
f795ed77c6
4 changed files with 24 additions and 14 deletions
|
@ -17,8 +17,10 @@
|
|||
* 59 Temple Place, Suite 330, Boston, *
|
||||
* MA 02111-1307 USA *
|
||||
*************************************************/
|
||||
require_once ("../../lib/base.php");
|
||||
require_once ("../../../lib/base.php");
|
||||
if(!OC_USER::isLoggedIn()) {
|
||||
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
|
||||
}
|
||||
?>
|
||||
$output = new OC_TEMPLATE("calendar", "part.getcal");
|
||||
$output -> printpage();
|
||||
?>
|
||||
|
|
|
@ -461,7 +461,7 @@ function oc_cal_switch2today() {
|
|||
}
|
||||
|
||||
function oc_cal_update_eventsvar(loadyear) {
|
||||
$("#js_events").load(oc_webroot + "/apps/calendar/ajax/ajax.php?task=load_events&year=" + loadyear);
|
||||
$("#js_events").load(oc_webroot + "/apps/calendar/ajax/getcal.php?year=" + loadyear);
|
||||
if(document.getElementById("js_events").innerHTML == "nosession") {
|
||||
alert("You are not logged in. That can happen if you don't use owncloud for a long time.");
|
||||
document.location(oc_webroot);
|
||||
|
@ -471,7 +471,7 @@ function oc_cal_update_eventsvar(loadyear) {
|
|||
$( "#parsingfail_dialog" ).dialog();
|
||||
});
|
||||
} else {
|
||||
events.concat(newevents);
|
||||
oc_cal_events[loadyear] = newevents[loadyear];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ $(document).ready(function(){
|
|||
alert("abc");
|
||||
}
|
||||
});
|
||||
oc_cal_update_eventsvar(oc_cal_year);
|
||||
oc_cal_update_view('');
|
||||
});
|
||||
//init date vars
|
||||
var oc_cal_date = new Date();
|
||||
|
@ -53,13 +55,4 @@ var oc_cal_datemonthyear = String(oc_cal_dayofmonth) + String(oc_cal_month) + S
|
|||
var oc_cal_calendars = new Array();
|
||||
//event vars
|
||||
var oc_cal_events = new Array();
|
||||
oc_cal_events[2011] = new Array();
|
||||
oc_cal_events[2011][7] = new Array();
|
||||
oc_cal_events[2011][7][7] = new Array();
|
||||
oc_cal_events[2011][7][7]['allday'] = new Array();
|
||||
oc_cal_events[2011][7][7]['allday'][1] = new Array();
|
||||
oc_cal_events[2011][7][7]['allday'][1]['description'] = 'allday event';
|
||||
oc_cal_events[2011][7][13] = new Array();
|
||||
oc_cal_events[2011][7][13][10] = new Array();
|
||||
oc_cal_events[2011][7][13][10][1] = new Array();
|
||||
oc_cal_events[2011][7][13][10][1]['description'] = '10:00 event';
|
||||
oc_cal_events[oc_cal_year] = new Array();
|
||||
|
|
15
apps/calendar/templates/part.getcal.php
Normal file
15
apps/calendar/templates/part.getcal.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php $year = $_GET["year"];
|
||||
//echo $year; ?>
|
||||
<script type="text/javascript">
|
||||
var newevents = new Array();
|
||||
newevents[2011] = new Array();
|
||||
newevents[2011][7] = new Array();
|
||||
newevents[2011][7][7] = new Array();
|
||||
newevents[2011][7][7]['allday'] = new Array();
|
||||
newevents[2011][7][7]['allday'][1] = new Array();
|
||||
newevents[2011][7][7]['allday'][1]['description'] = 'allday event';
|
||||
newevents[2011][7][13] = new Array();
|
||||
newevents[2011][7][13][10] = new Array();
|
||||
newevents[2011][7][13][10][1] = new Array();
|
||||
newevents[2011][7][13][10][1]['description'] = '10:00 event';
|
||||
</script>
|
Loading…
Reference in a new issue