OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
+if(trim($_POST['name']) == ''){
+ OC_JSON::error(array('message'=>'empty'));
+ exit;
+}
+$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+foreach($calendars as $cal){
+ if($cal['displayname'] == $_POST['name']){
+ OC_JSON::error(array('message'=>'namenotavailable'));
+ exit;
+ }
+}
+
$userid = OC_User::getUser();
$calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);
OC_Calendar_Calendar::setCalendarActive($calendarid, 1);
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
+if(trim($_POST['name']) == ''){
+ OC_JSON::error(array('message'=>'empty'));
+ exit;
+}
+$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
+foreach($calendars as $cal){
+ if($cal['displayname'] == $_POST['name'] && $cal['id'] != $_POST['id']){
+ OC_JSON::error(array('message'=>'namenotavailable'));
+ exit;
+ }
+}
+
$calendarid = $_POST['id'];
$calendar = OC_Calendar_App::getCalendar($calendarid);//access check
OC_Calendar_Calendar::editCalendar($calendarid, $_POST['name'], null, null, null, $_POST['color']);
}
},
submit:function(button, calendarid){
- var displayname = $("#displayname_"+calendarid).val();
+ var displayname = $.trim($("#displayname_"+calendarid).val());
var active = $("#edit_active_"+calendarid+":checked").length;
var description = $("#description_"+calendarid).val();
var calendarcolor = $("#calendarcolor_"+calendarid).val();
-
+ if(displayname == ''){
+ $("#displayname_"+calendarid).css('background-color', '#FF2626');
+ $("#displayname_"+calendarid).focus(function(){
+ $("#displayname_"+calendarid).css('background-color', '#F8F8F8');
+ });
+ }
+
var url;
if (calendarid == 'new'){
url = OC.filePath('calendar', 'ajax', 'createcalendar.php');
if (calendarid == 'new'){
$('#choosecalendar_dialog > table').append('<tr><td colspan="6"><a href="#" onclick="Calendar.UI.Calendar.newCalendar(this);"><input type="button" value="' + newcalendar + '"></a></td></tr>');
}
+ }else{
+ $("#displayname_"+calendarid).css('background-color', '#FF2626');
+ $("#displayname_"+calendarid).focus(function(){
+ $("#displayname_"+calendarid).css('background-color', '#F8F8F8');
+ });
}
}, 'json');
},
$('#calendar_holder').fullCalendar('option', 'aspectRatio', 1.35);
}
},
+ columnFormat: {
+ week: 'ddd d. MMM'
+ },
selectable: true,
selectHelper: true,
select: Calendar.UI.newEvent,