Eliminate most global calendar js vars
This commit is contained in:
parent
0df98b9a78
commit
fbde66a56c
|
@ -29,7 +29,6 @@ if( count($calendars) == 0){
|
||||||
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
||||||
}
|
}
|
||||||
OC_UTIL::addScript("calendar", "calendar");
|
OC_UTIL::addScript("calendar", "calendar");
|
||||||
OC_UTIL::addScript("calendar", "calendar_init");
|
|
||||||
OC_UTIL::addStyle("calendar", "style");
|
OC_UTIL::addStyle("calendar", "style");
|
||||||
OC_APP::setActiveNavigationEntry("calendar_index");
|
OC_APP::setActiveNavigationEntry("calendar_index");
|
||||||
$output = new OC_TEMPLATE("calendar", "calendar", "user");
|
$output = new OC_TEMPLATE("calendar", "calendar", "user");
|
||||||
|
|
|
@ -39,11 +39,12 @@
|
||||||
* loadEvents - load the events *
|
* loadEvents - load the events *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
Calendar={
|
Calendar={
|
||||||
|
space:' ',
|
||||||
Date:{
|
Date:{
|
||||||
normal_year_cal: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
normal_year_cal: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
||||||
leap_year_cal: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
leap_year_cal: [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
||||||
calw:function() {
|
calw:function() {
|
||||||
var dayofweek = oc_cal_dayofweek;
|
var dayofweek = this.current.getDay();
|
||||||
if(dayofweek == 0) {
|
if(dayofweek == 0) {
|
||||||
dayofweek = 7;
|
dayofweek = 7;
|
||||||
}
|
}
|
||||||
|
@ -52,12 +53,12 @@ Calendar={
|
||||||
},
|
},
|
||||||
|
|
||||||
doy:function() {
|
doy:function() {
|
||||||
var cal = this.getnumberofdays(oc_cal_year);
|
var cal = this.getnumberofdays(this.current.getFullYear());
|
||||||
var doy = 0;
|
var doy = 0;
|
||||||
for(var i = 0; i < oc_cal_month; i++) {
|
for(var i = 0; i < this.current.getMonth(); i++) {
|
||||||
doy = doy + parseInt(cal[i]);
|
doy = doy + cal[i];
|
||||||
}
|
}
|
||||||
doy = doy + parseInt(oc_cal_dayofmonth);
|
doy = doy + this.current.getDate();
|
||||||
return doy;
|
return doy;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -83,132 +84,119 @@ Calendar={
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
current:new Date(),
|
||||||
forward_day:function(){
|
forward_day:function(){
|
||||||
var cal = this.getnumberofdays(oc_cal_year);
|
this.current.setDate(this.current.getDate()+1);
|
||||||
if(oc_cal_dayofmonth == cal[oc_cal_month]) {
|
|
||||||
if(oc_cal_month == 11) {
|
|
||||||
oc_cal_year++;
|
|
||||||
oc_cal_month = 0;
|
|
||||||
oc_cal_dayofmonth = 1;
|
|
||||||
} else {
|
|
||||||
oc_cal_month++;
|
|
||||||
oc_cal_dayofmonth = 1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
oc_cal_dayofmonth++;
|
|
||||||
}
|
|
||||||
if(oc_cal_dayofweek == 6) {
|
|
||||||
oc_cal_dayofweek = 0;
|
|
||||||
} else {
|
|
||||||
oc_cal_dayofweek++;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
forward_week:function(){
|
forward_week:function(){
|
||||||
for(var i = 1; i <= 7; i++) {
|
this.current.setDate(this.current.getDate()+7);
|
||||||
this.forward_day();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
forward_month:function(){
|
forward_month:function(){
|
||||||
var cal = this.getnumberofdays(oc_cal_year);
|
this.current.setMonth(this.current.getMonth()+1);
|
||||||
for(var i = 1; i <= cal[oc_cal_month]; i++) {
|
|
||||||
this.forward_day();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
backward_day:function(){
|
backward_day:function(){
|
||||||
var cal = this.getnumberofdays(oc_cal_year);
|
this.current.setDate(this.current.getDate()-1);
|
||||||
if(oc_cal_dayofmonth == 1) {
|
|
||||||
if(oc_cal_month == 0) {
|
|
||||||
oc_cal_year--;
|
|
||||||
oc_cal_month = 11;
|
|
||||||
oc_cal_dayofmonth = 31
|
|
||||||
} else {
|
|
||||||
oc_cal_month--;
|
|
||||||
oc_cal_dayofmonth = cal[oc_cal_month];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
oc_cal_dayofmonth--;
|
|
||||||
}
|
|
||||||
if(oc_cal_dayofweek == 0) {
|
|
||||||
oc_cal_dayofweek = 6;
|
|
||||||
} else {
|
|
||||||
oc_cal_dayofweek--;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
backward_week:function(){
|
backward_week:function(){
|
||||||
for(var i = 1; i <= 7; i++) {
|
this.current.setDate(this.current.getDate()-7);
|
||||||
this.backward_day();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
backward_month:function(){
|
backward_month:function(){
|
||||||
var cal = this.getnumberofdays(oc_cal_year);
|
this.current.setMonth(this.current.getMonth()-1);
|
||||||
for(var i = cal[oc_cal_month]; i >= 1; i--) {
|
|
||||||
this.backward_day();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
UI:{
|
UI:{
|
||||||
weekdays: ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
|
weekdays: ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"],
|
||||||
|
formatDayShort:function(day){
|
||||||
|
if (typeof(day) == 'undefined'){
|
||||||
|
day = Calendar.Date.current.getDay();
|
||||||
|
}
|
||||||
|
return this.dayshort[day];
|
||||||
|
},
|
||||||
|
formatDayLong:function(day){
|
||||||
|
if (typeof(day) == 'undefined'){
|
||||||
|
day = Calendar.Date.current.getDay();
|
||||||
|
}
|
||||||
|
return this.daylong[day];
|
||||||
|
},
|
||||||
|
formatMonthShort:function(month){
|
||||||
|
if (typeof(month) == 'undefined'){
|
||||||
|
month = Calendar.Date.current.getMonth();
|
||||||
|
}
|
||||||
|
return this.monthshort[month];
|
||||||
|
},
|
||||||
|
formatMonthLong:function(month){
|
||||||
|
if (typeof(month) == 'undefined'){
|
||||||
|
month = Calendar.Date.current.getMonth();
|
||||||
|
}
|
||||||
|
return this.monthlong[month];
|
||||||
|
},
|
||||||
updateView:function(task) {
|
updateView:function(task) {
|
||||||
this.current.removeEvents();
|
this.current.removeEvents();
|
||||||
this.current.renderCal();
|
this.current.renderCal();
|
||||||
this.current.showEvents();
|
this.current.showEvents();
|
||||||
},
|
},
|
||||||
|
currentview:'none',
|
||||||
setCurrentView:function(view){
|
setCurrentView:function(view){
|
||||||
if (view == oc_cal_currentview){
|
if (view == this.currentview){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('#'+oc_cal_currentview).hide();
|
$('#'+this.currentview).hide();
|
||||||
$('#'+oc_cal_currentview + "_radio").removeClass('active');
|
$('#'+this.currentview + "_radio").removeClass('active');
|
||||||
oc_cal_currentview = view;
|
this.currentview = view;
|
||||||
//sending ajax request on every change view
|
//sending ajax request on every change view
|
||||||
$("#sysbox").load(oc_webroot + "/apps/calendar/ajax/changeview.php?v="+view);
|
$("#sysbox").load(oc_webroot + "/apps/calendar/ajax/changeview.php?v="+view);
|
||||||
//not necessary to check whether the response is true or not
|
//not necessary to check whether the response is true or not
|
||||||
switch(view) {
|
switch(view) {
|
||||||
case "onedayview":
|
case "onedayview":
|
||||||
this.current = Calendar.UI.OneDay;
|
this.current = this.OneDay;
|
||||||
break;
|
break;
|
||||||
case "oneweekview":
|
case "oneweekview":
|
||||||
this.current = Calendar.UI.OneWeek;
|
this.current = this.OneWeek;
|
||||||
break;
|
break;
|
||||||
case "fourweeksview":
|
case "fourweeksview":
|
||||||
this.current = Calendar.UI.FourWeeks;
|
this.current = this.FourWeeks;
|
||||||
break;
|
break;
|
||||||
case "onemonthview":
|
case "onemonthview":
|
||||||
this.current = Calendar.UI.OneMonth;
|
this.current = this.OneMonth;
|
||||||
break;
|
break;
|
||||||
case "listview":
|
case "listview":
|
||||||
this.current = Calendar.UI.List;
|
this.current = this.List;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
alert('Unknown view:'+view);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$('#'+oc_cal_currentview).show();
|
$('#'+this.currentview).show();
|
||||||
$('#'+oc_cal_currentview + "_radio").addClass('active');
|
$('#'+this.currentview + "_radio").addClass('active');
|
||||||
this.updateView();
|
this.updateView();
|
||||||
},
|
},
|
||||||
updateDate:function(direction){
|
updateDate:function(direction){
|
||||||
if(direction == "forward") {
|
if(direction == "forward") {
|
||||||
this.current.forward();
|
this.current.forward();
|
||||||
if(oc_cal_month == 11){
|
if(Calendar.Date.current.getMonth() == 11){
|
||||||
this.loadEvents(oc_cal_year + 1);
|
this.loadEvents(Calendar.Date.current.getFullYear() + 1);
|
||||||
}
|
}
|
||||||
Calendar.UI.updateView();
|
this.updateView();
|
||||||
}
|
}
|
||||||
if(direction == "backward") {
|
if(direction == "backward") {
|
||||||
this.current.backward();
|
this.current.backward();
|
||||||
if(oc_cal_month == 0){
|
if(Calendar.Date.current.getMonth() == 0){
|
||||||
this.loadEvents(oc_cal_year - 1);
|
this.loadEvents(Calendar.Date.current.getFullYear() - 1);
|
||||||
}
|
}
|
||||||
Calendar.UI.updateView();
|
this.updateView();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
events:[],
|
||||||
loadEvents:function(year){
|
loadEvents:function(year){
|
||||||
|
if( typeof (this.events[year]) == "undefined") {
|
||||||
|
this.events[year] = []
|
||||||
|
}
|
||||||
$.getJSON(oc_webroot + "/apps/calendar/ajax/getcal.php?year=" + year, function(newevents, status) {
|
$.getJSON(oc_webroot + "/apps/calendar/ajax/getcal.php?year=" + year, function(newevents, status) {
|
||||||
if(status == "nosession") {
|
if(status == "nosession") {
|
||||||
alert("You are not logged in. That can happen if you don't use owncloud for a long time.");
|
alert("You are not logged in. That can happen if you don't use owncloud for a long time.");
|
||||||
|
@ -219,10 +207,10 @@ Calendar={
|
||||||
$( "#parsingfail_dialog" ).dialog();
|
$( "#parsingfail_dialog" ).dialog();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
oc_cal_events[year] = newevents[year];
|
Calendar.UI.events[year] = newevents[year];
|
||||||
//$.ready(function() {
|
$(document).ready(function() {
|
||||||
Calendar.UI.updateView();
|
Calendar.UI.updateView();
|
||||||
//});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -230,16 +218,16 @@ Calendar={
|
||||||
var day = date[0];
|
var day = date[0];
|
||||||
var month = date[1];
|
var month = date[1];
|
||||||
var year = date[2];
|
var year = date[2];
|
||||||
if( typeof (oc_cal_events[year]) == "undefined") {
|
if( typeof (this.events[year]) == "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( typeof (oc_cal_events[year][month]) == "undefined") {
|
if( typeof (this.events[year][month]) == "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( typeof (oc_cal_events[year][month][day]) == "undefined") {
|
if( typeof (this.events[year][month][day]) == "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
events = oc_cal_events[year][month][day];
|
events = this.events[year][month][day];
|
||||||
if( typeof (events["allday"]) != "undefined") {
|
if( typeof (events["allday"]) != "undefined") {
|
||||||
var eventnumber = 1;
|
var eventnumber = 1;
|
||||||
var eventcontainer = this.current.getEventContainer(week, weekday, "allday");
|
var eventcontainer = this.current.getEventContainer(week, weekday, "allday");
|
||||||
|
@ -315,11 +303,11 @@ Calendar={
|
||||||
var dayofmonth = date[0];
|
var dayofmonth = date[0];
|
||||||
var month = date[1];
|
var month = date[1];
|
||||||
var year = date[2];
|
var year = date[2];
|
||||||
if(parseInt(dayofmonth) <= 9){
|
if(dayofmonth <= 9){
|
||||||
dayofmonth = "0" + dayofmonth;
|
dayofmonth = "0" + dayofmonth;
|
||||||
}
|
}
|
||||||
month++;
|
month++;
|
||||||
if(parseInt(month) <= 9){
|
if(month <= 9){
|
||||||
month = "0" + month;
|
month = "0" + month;
|
||||||
}
|
}
|
||||||
var title = String(dayofmonth) + String(month) + String(year);
|
var title = String(dayofmonth) + String(month) + String(year);
|
||||||
|
@ -336,12 +324,12 @@ Calendar={
|
||||||
$("#onedayview .calendar_row").html("");
|
$("#onedayview .calendar_row").html("");
|
||||||
},
|
},
|
||||||
renderCal:function(){
|
renderCal:function(){
|
||||||
$("#datecontrol_date").val(oc_cal_dayshort[oc_cal_dayofweek] + oc_cal_space + oc_cal_dayofmonth + oc_cal_space + oc_cal_monthshort[oc_cal_month] + oc_cal_space + oc_cal_year);
|
$("#datecontrol_date").val(Calendar.UI.formatDayShort() + Calendar.space + Calendar.Date.current.getDate() + Calendar.space + Calendar.UI.formatMonthShort() + Calendar.space + Calendar.Date.current.getFullYear());
|
||||||
$("#onedayview_today").html(oc_cal_daylong[oc_cal_dayofweek] + oc_cal_space + oc_cal_dayofmonth + oc_cal_space + oc_cal_monthshort[oc_cal_month]);
|
$("#onedayview_today").html(Calendar.UI.formatDayLong() + Calendar.space + Calendar.Date.current.getDate() + Calendar.space + Calendar.UI.formatMonthShort());
|
||||||
Calendar.UI.addDateInfo('#onedayview_today', [oc_cal_dayofmonth, oc_cal_month, oc_cal_year]);
|
Calendar.UI.addDateInfo('#onedayview_today', [Calendar.Date.current.getDate(), Calendar.Date.current.getMonth(), Calendar.Date.current.getFullYear()]);
|
||||||
},
|
},
|
||||||
showEvents:function(){
|
showEvents:function(){
|
||||||
Calendar.UI.createEventsForDate([oc_cal_dayofmonth, oc_cal_month, oc_cal_year], 0, 0);
|
Calendar.UI.createEventsForDate([Calendar.Date.current.getDate(), Calendar.Date.current.getMonth(), Calendar.Date.current.getFullYear()], 0, 0);
|
||||||
},
|
},
|
||||||
getEventContainer:function(week, weekday, when){
|
getEventContainer:function(week, weekday, when){
|
||||||
return $("#onedayview ." + when);
|
return $("#onedayview ." + when);
|
||||||
|
@ -369,11 +357,12 @@ Calendar={
|
||||||
$("#oneweekview .thisday").removeClass("thisday");
|
$("#oneweekview .thisday").removeClass("thisday");
|
||||||
},
|
},
|
||||||
renderCal:function(){
|
renderCal:function(){
|
||||||
$("#datecontrol_date").val(cw_label + ": " + Calendar.Date.calw());
|
$("#datecontrol_date").val(Calendar.UI.cw_label + ": " + Calendar.Date.calw());
|
||||||
var dates = this.generateDates();
|
var dates = this.generateDates();
|
||||||
|
var today = new Date();
|
||||||
for(var i = 0; i <= 6; i++){
|
for(var i = 0; i <= 6; i++){
|
||||||
$("#oneweekview th." + Calendar.UI.weekdays[i]).html(oc_cal_dayshort[(i+1)%7] + oc_cal_space + dates[i][0] + oc_cal_space + oc_cal_monthshort[dates[i][1]]);
|
$("#oneweekview th." + Calendar.UI.weekdays[i]).html(Calendar.UI.formatDayShort((i+1)%7) + Calendar.space + dates[i][0] + Calendar.space + Calendar.UI.formatMonthShort(dates[i][1]));
|
||||||
if(dates[i][0] == oc_cal_todaydayofmonth && dates[i][1] == oc_cal_todaymonth && dates[i][2] == oc_cal_todayyear){
|
if(dates[i][0] == today.getDate() && dates[i][1] == today.getMonth() && dates[i][2] == today.getFullYear()){
|
||||||
$("#oneweekview ." + Calendar.UI.weekdays[i]).addClass("thisday");
|
$("#oneweekview ." + Calendar.UI.weekdays[i]).addClass("thisday");
|
||||||
}
|
}
|
||||||
Calendar.UI.addDateInfo('#oneweekview th.' + Calendar.UI.weekdays[i], dates[i]);
|
Calendar.UI.addDateInfo('#oneweekview th.' + Calendar.UI.weekdays[i], dates[i]);
|
||||||
|
@ -398,7 +387,7 @@ Calendar={
|
||||||
},
|
},
|
||||||
generateDates:function(){
|
generateDates:function(){
|
||||||
var dates = new Array();
|
var dates = new Array();
|
||||||
var date = new Date(oc_cal_year, oc_cal_month, oc_cal_dayofmonth);
|
var date = new Date(Calendar.Date.current)
|
||||||
var dayofweek = date.getDay();
|
var dayofweek = date.getDay();
|
||||||
if(dayofweek == 0) {
|
if(dayofweek == 0) {
|
||||||
dayofweek = 7;
|
dayofweek = 7;
|
||||||
|
@ -445,12 +434,13 @@ Calendar={
|
||||||
var dates = this.generateDates();
|
var dates = this.generateDates();
|
||||||
var week = 1;
|
var week = 1;
|
||||||
var weekday = 0;
|
var weekday = 0;
|
||||||
|
var today = new Date();
|
||||||
for(var i = 0; i <= 27; i++){
|
for(var i = 0; i <= 27; i++){
|
||||||
var dayofmonth = dates[i][0];
|
var dayofmonth = dates[i][0];
|
||||||
var month = dates[i][1];
|
var month = dates[i][1];
|
||||||
var year = dates[i][2];
|
var year = dates[i][2];
|
||||||
$("#fourweeksview .week_" + week + " ." + Calendar.UI.weekdays[weekday] + " .dateinfo").html(dayofmonth + oc_cal_space + oc_cal_monthshort[month]);
|
$("#fourweeksview .week_" + week + " ." + Calendar.UI.weekdays[weekday] + " .dateinfo").html(dayofmonth + Calendar.space + Calendar.UI.formatMonthShort(month));
|
||||||
if(dayofmonth == oc_cal_todaydayofmonth && month == oc_cal_todaymonth && year == oc_cal_todayyear){
|
if(dayofmonth == today.getDate() && month == today.getMonth() && year == today.getFullYear()){
|
||||||
$("#fourweeksview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).addClass('thisday');
|
$("#fourweeksview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).addClass('thisday');
|
||||||
}
|
}
|
||||||
Calendar.UI.addDateInfo('#fourweeksview .week_' + week + ' .' + Calendar.UI.weekdays[weekday], dates[i]);
|
Calendar.UI.addDateInfo('#fourweeksview .week_' + week + ' .' + Calendar.UI.weekdays[weekday], dates[i]);
|
||||||
|
@ -465,7 +455,7 @@ Calendar={
|
||||||
$("#fourweeksview .week_2 .calw").html(calw2);
|
$("#fourweeksview .week_2 .calw").html(calw2);
|
||||||
$("#fourweeksview .week_3 .calw").html(calw3);
|
$("#fourweeksview .week_3 .calw").html(calw3);
|
||||||
$("#fourweeksview .week_4 .calw").html(calw4);
|
$("#fourweeksview .week_4 .calw").html(calw4);
|
||||||
$("#datecontrol_date").val(cws_label + ": " + Calendar.Date.calw() + " - " + calwplusfour);
|
$("#datecontrol_date").val(Calendar.UI.cws_label + ": " + Calendar.Date.calw() + " - " + calwplusfour);
|
||||||
},
|
},
|
||||||
showEvents:function(){
|
showEvents:function(){
|
||||||
var dates = this.generateDates();
|
var dates = this.generateDates();
|
||||||
|
@ -494,7 +484,7 @@ Calendar={
|
||||||
},
|
},
|
||||||
generateDates:function(){
|
generateDates:function(){
|
||||||
var dates = new Array();
|
var dates = new Array();
|
||||||
var date = new Date(oc_cal_year, oc_cal_month, oc_cal_dayofmonth);
|
var date = new Date(Calendar.Date.current)
|
||||||
var dayofweek = date.getDay();
|
var dayofweek = date.getDay();
|
||||||
if(dayofweek == 0) {
|
if(dayofweek == 0) {
|
||||||
dayofweek = 7;
|
dayofweek = 7;
|
||||||
|
@ -519,10 +509,10 @@ Calendar={
|
||||||
$('#onemonthview .day .events').html('');
|
$('#onemonthview .day .events').html('');
|
||||||
},
|
},
|
||||||
renderCal:function(){
|
renderCal:function(){
|
||||||
$("#datecontrol_date").val(oc_cal_monthlong[oc_cal_month] + oc_cal_space + oc_cal_year);
|
$("#datecontrol_date").val(Calendar.UI.formatMonthLong() + Calendar.space + Calendar.Date.current.getFullYear());
|
||||||
var cal = Calendar.Date.getnumberofdays(oc_cal_year);
|
var cal = Calendar.Date.getnumberofdays(Calendar.Date.current.getFullYear());
|
||||||
var monthview_dayofweek = oc_cal_dayofweek;
|
var monthview_dayofweek = Calendar.Date.current.getDay();
|
||||||
var monthview_dayofmonth = oc_cal_dayofmonth;
|
var monthview_dayofmonth = Calendar.Date.current.getDate();
|
||||||
for(var i = monthview_dayofmonth; i > 1; i--) {
|
for(var i = monthview_dayofmonth; i > 1; i--) {
|
||||||
if(monthview_dayofweek == 0) {
|
if(monthview_dayofweek == 0) {
|
||||||
monthview_dayofweek = 6;
|
monthview_dayofweek = 6;
|
||||||
|
@ -532,18 +522,19 @@ Calendar={
|
||||||
}
|
}
|
||||||
$("#onemonthview .week_5").hide();
|
$("#onemonthview .week_5").hide();
|
||||||
$("#onemonthview .week_6").hide();
|
$("#onemonthview .week_6").hide();
|
||||||
oc_cal_rows = parseInt(monthview_dayofweek) + parseInt(cal[oc_cal_month]);
|
this.rows = monthview_dayofweek + cal[Calendar.Date.current.getMonth()];
|
||||||
oc_cal_rows = oc_cal_rows / 7;
|
this.rows = this.rows / 7;
|
||||||
oc_cal_rows = Math.ceil(oc_cal_rows);
|
this.rows = Math.ceil(this.rows);
|
||||||
var dates = this.generateDates();
|
var dates = this.generateDates();
|
||||||
var week = 1;
|
var week = 1;
|
||||||
var weekday = 0;
|
var weekday = 0;
|
||||||
|
var today = new Date();
|
||||||
for(var i = 0; i <= 41; i++){
|
for(var i = 0; i <= 41; i++){
|
||||||
var dayofmonth = dates[i][0];
|
var dayofmonth = dates[i][0];
|
||||||
var month = dates[i][1];
|
var month = dates[i][1];
|
||||||
var year = dates[i][2];
|
var year = dates[i][2];
|
||||||
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday] + " .dateinfo").html(dayofmonth + oc_cal_space + oc_cal_monthshort[month]);
|
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday] + " .dateinfo").html(dayofmonth + Calendar.space + Calendar.UI.formatMonthShort(month));
|
||||||
if(dayofmonth == oc_cal_todaydayofmonth && month == oc_cal_todaymonth && year == oc_cal_todayyear){
|
if(dayofmonth == today.getDate() && month == today.getMonth() && year == today.getFullYear()){
|
||||||
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).addClass('thisday');
|
$("#onemonthview .week_" + week + " ." + Calendar.UI.weekdays[weekday]).addClass('thisday');
|
||||||
}
|
}
|
||||||
Calendar.UI.addDateInfo('#onemonthview .week_' + week + ' .' + Calendar.UI.weekdays[weekday], dates[i]);
|
Calendar.UI.addDateInfo('#onemonthview .week_' + week + ' .' + Calendar.UI.weekdays[weekday], dates[i]);
|
||||||
|
@ -554,18 +545,18 @@ Calendar={
|
||||||
weekday++;
|
weekday++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(oc_cal_rows == 4){
|
if(this.rows == 4){
|
||||||
for(var i = 1;i <= 6;i++){
|
for(var i = 1;i <= 6;i++){
|
||||||
$("#onemonthview .week_" + String(i)).height("23%");
|
$("#onemonthview .week_" + String(i)).height("23%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(oc_cal_rows == 5) {
|
if(this.rows == 5) {
|
||||||
$("#onemonthview .week_5").show();
|
$("#onemonthview .week_5").show();
|
||||||
for(var i = 1;i <= 6;i++){
|
for(var i = 1;i <= 6;i++){
|
||||||
$("#onemonthview .week_" + String(i)).height("18%");
|
$("#onemonthview .week_" + String(i)).height("18%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(oc_cal_rows == 6) {
|
if(this.rows == 6) {
|
||||||
$("#onemonthview .week_5").show();
|
$("#onemonthview .week_5").show();
|
||||||
$("#onemonthview .week_6").show();
|
$("#onemonthview .week_6").show();
|
||||||
for(var i = 1;i <= 6;i++){
|
for(var i = 1;i <= 6;i++){
|
||||||
|
@ -600,12 +591,12 @@ Calendar={
|
||||||
},
|
},
|
||||||
generateDates:function(){
|
generateDates:function(){
|
||||||
var dates = new Array();
|
var dates = new Array();
|
||||||
var date = new Date(oc_cal_year, oc_cal_month, oc_cal_dayofmonth);
|
var date = new Date(Calendar.Date.current)
|
||||||
date.setDate(1);
|
date.setDate(1);
|
||||||
var dayofweek = date.getDay();
|
var dayofweek = date.getDay();
|
||||||
if(dayofweek == 0) {
|
if(dayofweek == 0) {
|
||||||
dayofweek = 7;
|
dayofweek = 7;
|
||||||
oc_cal_rows++;
|
this.rows++;
|
||||||
}
|
}
|
||||||
date.setDate(date.getDate() - dayofweek + 1);
|
date.setDate(date.getDate() - dayofweek + 1);
|
||||||
for(var i = 0; i <= 41; i++) {
|
for(var i = 0; i <= 41; i++) {
|
||||||
|
@ -626,7 +617,7 @@ Calendar={
|
||||||
$("#listview").html("");
|
$("#listview").html("");
|
||||||
},
|
},
|
||||||
renderCal:function(){
|
renderCal:function(){
|
||||||
$("#datecontrol_date").val(oc_cal_dayshort[oc_cal_dayofweek] + oc_cal_space + oc_cal_dayofmonth + oc_cal_space + oc_cal_monthshort[oc_cal_month] + oc_cal_space + oc_cal_year);
|
$("#datecontrol_date").val(Calendar.UI.formatDayShort() + Calendar.space + Calendar.Date.current.getDate() + Calendar.space + Calendar.UI.formatMonthShort() + Calendar.space + Calendar.Date.current.getFullYear());
|
||||||
},
|
},
|
||||||
showEvents:function(){
|
showEvents:function(){
|
||||||
},
|
},
|
||||||
|
@ -643,16 +634,15 @@ Calendar={
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//event vars
|
||||||
|
Calendar.UI.loadEvents(Calendar.Date.current.getFullYear());
|
||||||
|
|
||||||
function oc_cal_switch2today() {
|
function oc_cal_switch2today() {
|
||||||
oc_cal_date = oc_cal_today;
|
Calendar.Date.current = new Date();
|
||||||
oc_cal_dayofweek = oc_cal_todaydayofweek;
|
|
||||||
oc_cal_month = oc_cal_todaymonth;
|
|
||||||
oc_cal_dayofmonth = oc_cal_todaydayofmonth;
|
|
||||||
oc_cal_year = oc_cal_todayyear;
|
|
||||||
Calendar.UI.updateView();
|
Calendar.UI.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var oc_cal_opendialog = 0;
|
||||||
function oc_cal_newevent(selector, time){
|
function oc_cal_newevent(selector, time){
|
||||||
var date = $(selector).data('date_info');
|
var date = $(selector).data('date_info');
|
||||||
if(oc_cal_opendialog == 0){
|
if(oc_cal_opendialog == 0){
|
||||||
|
@ -675,7 +665,7 @@ function oc_cal_calender_activation(checkbox, calendarid)
|
||||||
$.post(oc_webroot + "/apps/calendar/ajax/activation.php", { calendarid: calendarid, active: checkbox.checked?1:0 },
|
$.post(oc_webroot + "/apps/calendar/ajax/activation.php", { calendarid: calendarid, active: checkbox.checked?1:0 },
|
||||||
function(data) {
|
function(data) {
|
||||||
checkbox.checked = data == 1;
|
checkbox.checked = data == 1;
|
||||||
Calendar.UI.loadEvents(oc_cal_year);
|
Calendar.UI.loadEvents(Calendar.Date.current.getFullYear());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function oc_cal_editcalendar(object, calendarid){
|
function oc_cal_editcalendar(object, calendarid){
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
/*************************************************
|
|
||||||
* ownCloud - Calendar Plugin *
|
|
||||||
* *
|
|
||||||
* (c) Copyright 2011 Georg Ehrke *
|
|
||||||
* author: Georg Ehrke *
|
|
||||||
* email: ownclouddev at georgswebsite dot de *
|
|
||||||
* homepage: ownclouddev.georgswebsite.de *
|
|
||||||
* manual: ownclouddev.georgswebsite.de/manual *
|
|
||||||
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
|
||||||
* *
|
|
||||||
* <http://www.gnu.org/licenses/> *
|
|
||||||
* If you are not able to view the License, *
|
|
||||||
* <http://www.gnu.org/licenses/> *
|
|
||||||
* <http://ownclouddev.georgswebsite.de/license/> *
|
|
||||||
* please write to the Free Software Foundation. *
|
|
||||||
* Address: *
|
|
||||||
* 59 Temple Place, Suite 330, Boston, *
|
|
||||||
* MA 02111-1307 USA *
|
|
||||||
*************************************************/
|
|
||||||
//loading multiselect
|
|
||||||
$(document).ready(function(){
|
|
||||||
$("#calendar_select").multiSelect({
|
|
||||||
selectedText: "Calendars",
|
|
||||||
noneSelectedText: "Calendars",
|
|
||||||
selectedList: 0,
|
|
||||||
close: function(){
|
|
||||||
alert("abc");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
//init date vars
|
|
||||||
var oc_cal_date = new Date();
|
|
||||||
var oc_cal_dayofweek = oc_cal_date.getDay();
|
|
||||||
var oc_cal_month = oc_cal_date.getMonth();
|
|
||||||
var oc_cal_dayofmonth = oc_cal_date.getDate();
|
|
||||||
var oc_cal_year = oc_cal_date.getFullYear();
|
|
||||||
var oc_cal_space = " ";
|
|
||||||
//init today date vars
|
|
||||||
var oc_cal_today = new Date();
|
|
||||||
var oc_cal_todaydayofweek = oc_cal_today.getDay();
|
|
||||||
var oc_cal_todaymonth = oc_cal_today.getMonth();
|
|
||||||
var oc_cal_todaydayofmonth = oc_cal_today.getDate();
|
|
||||||
var oc_cal_todayyear = oc_cal_today.getFullYear();
|
|
||||||
//other vars
|
|
||||||
var oc_cal_rows;
|
|
||||||
var oc_cal_dates;
|
|
||||||
var oc_cal_listview_numofevents = 0;
|
|
||||||
var oc_cal_listview_count = 0;
|
|
||||||
var oc_cal_opendialog = 0;
|
|
||||||
var oc_cal_datemonthyear = String(oc_cal_dayofmonth) + String(oc_cal_month) + String(oc_cal_year);
|
|
||||||
var oc_cal_calendars = new Array();
|
|
||||||
//event vars
|
|
||||||
var oc_cal_events = new Array();
|
|
||||||
oc_cal_events[oc_cal_year] = new Array();
|
|
||||||
var oc_cal_currentview;
|
|
||||||
Calendar.UI.loadEvents(oc_cal_year);
|
|
|
@ -5,4 +5,3 @@
|
||||||
../templates/part.newevent.php
|
../templates/part.newevent.php
|
||||||
../templates/part.choosecalendar.php
|
../templates/part.choosecalendar.php
|
||||||
../js/calendar.js
|
../js/calendar.js
|
||||||
../js/calendar_init.js
|
|
|
@ -29,12 +29,12 @@ $hours = array(
|
||||||
$weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
|
$weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var oc_cal_daylong = new Array("<?php echo $l -> t("Sunday");?>", "<?php echo $l -> t("Monday");?>", "<?php echo $l -> t("Tuesday");?>", "<?php echo $l -> t("Wednesday");?>", "<?php echo $l -> t("Thursday");?>", "<?php echo $l -> t("Friday");?>", "<?php echo $l -> t("Saturday");?>");
|
Calendar.UI.daylong = new Array("<?php echo $l -> t("Sunday");?>", "<?php echo $l -> t("Monday");?>", "<?php echo $l -> t("Tuesday");?>", "<?php echo $l -> t("Wednesday");?>", "<?php echo $l -> t("Thursday");?>", "<?php echo $l -> t("Friday");?>", "<?php echo $l -> t("Saturday");?>");
|
||||||
var oc_cal_dayshort = new Array("<?php echo $l -> t("Sun.");?>", "<?php echo $l -> t("Mon.");?>", "<?php echo $l -> t("Tue.");?>", "<?php echo $l -> t("Wed.");?>", "<?php echo $l -> t("Thu.");?>", "<?php echo $l -> t("Fri.");?>", "<?php echo $l -> t("Sat.");?>");
|
Calendar.UI.dayshort = new Array("<?php echo $l -> t("Sun.");?>", "<?php echo $l -> t("Mon.");?>", "<?php echo $l -> t("Tue.");?>", "<?php echo $l -> t("Wed.");?>", "<?php echo $l -> t("Thu.");?>", "<?php echo $l -> t("Fri.");?>", "<?php echo $l -> t("Sat.");?>");
|
||||||
var oc_cal_monthlong = new Array("<?php echo $l -> t("January");?>", "<?php echo $l -> t("February");?>", "<?php echo $l -> t("March");?>", "<?php echo $l -> t("April");?>", "<?php echo $l -> t("May");?>", "<?php echo $l -> t("June");?>", "<?php echo $l -> t("July");?>", "<?php echo $l -> t("August");?>", "<?php echo $l -> t("September");?>", "<?php echo $l -> t("October");?>", "<?php echo $l -> t("November");?>", "<?php echo $l -> t("December");?>");
|
Calendar.UI.monthlong = new Array("<?php echo $l -> t("January");?>", "<?php echo $l -> t("February");?>", "<?php echo $l -> t("March");?>", "<?php echo $l -> t("April");?>", "<?php echo $l -> t("May");?>", "<?php echo $l -> t("June");?>", "<?php echo $l -> t("July");?>", "<?php echo $l -> t("August");?>", "<?php echo $l -> t("September");?>", "<?php echo $l -> t("October");?>", "<?php echo $l -> t("November");?>", "<?php echo $l -> t("December");?>");
|
||||||
var oc_cal_monthshort = new Array("<?php echo $l -> t("Jan.");?>", "<?php echo $l -> t("Feb.");?>", "<?php echo $l -> t("Mar.");?>", "<?php echo $l -> t("Apr.");?>", "<?php echo $l -> t("May");?>", "<?php echo $l -> t("Jun.");?>", "<?php echo $l -> t("Jul.");?>", "<?php echo $l -> t("Aug.");?>", "<?php echo $l -> t("Sep.");?>", "<?php echo $l -> t("Oct.");?>", "<?php echo $l -> t("Nov.");?>", "<?php echo $l -> t("Dec.");?>");
|
Calendar.UI.monthshort = new Array("<?php echo $l -> t("Jan.");?>", "<?php echo $l -> t("Feb.");?>", "<?php echo $l -> t("Mar.");?>", "<?php echo $l -> t("Apr.");?>", "<?php echo $l -> t("May");?>", "<?php echo $l -> t("Jun.");?>", "<?php echo $l -> t("Jul.");?>", "<?php echo $l -> t("Aug.");?>", "<?php echo $l -> t("Sep.");?>", "<?php echo $l -> t("Oct.");?>", "<?php echo $l -> t("Nov.");?>", "<?php echo $l -> t("Dec.");?>");
|
||||||
var cw_label = "<?php echo $l->t("Week");?>";
|
Calendar.UI.cw_label = "<?php echo $l->t("Week");?>";
|
||||||
var cws_label = "<?php echo $l->t("Weeks");?>";
|
Calendar.UI.cws_label = "<?php echo $l->t("Weeks");?>";
|
||||||
</script>
|
</script>
|
||||||
<div id="sysbox"></div>
|
<div id="sysbox"></div>
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
|
|
Loading…
Reference in New Issue