Changeset 5381
- Timestamp:
- 01/15/12 15:23:09 (12 years ago)
- Location:
- trunk/prototype/modules/calendar
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/calendar/index.php
r5358 r5381 214 214 $('.ui-datepicker-title .ui-datepicker-month').live('click',function(){ 215 215 $tabs.tabs("select", "#calendar"); 216 var currentDate = $.fullCalendar.formatDate($('#calendar').fullCalendar('getDate'), "yyyy-MM-dd").split('-'); 217 $('#calendar').fullCalendar('gotoDate',$('.ui-datepicker-title .ui-datepicker-year').html(), Date.getMonthNumberFromName($('.ui-datepicker-title .ui-datepicker-month').html()),currentDate[2]); 216 $('#calendar').fullCalendar('gotoDate',$(this).siblings('span').html(), Date.getMonthNumberFromName($(this).html() == 'Março' ? 'Mar' : $(this).html()),'01'); 218 217 $('#calendar').fullCalendar( 'changeView', 'month'); 219 218 }); … … 221 220 $('.ui-datepicker-title .ui-datepicker-year').live('click',function(){ 222 221 $tabs.tabs("select", "#calendar"); 223 var currentDate = $.fullCalendar.formatDate($('#calendar').fullCalendar('getDate'), "yyyy-MM-dd").split('-'); 224 $('#calendar').fullCalendar('gotoDate',$('.ui-datepicker-title .ui-datepicker-year').html(), Date.getMonthNumberFromName($('.ui-datepicker-title .ui-datepicker-month').html()), currentDate[2]); 222 $('#calendar').fullCalendar('gotoDate',$(this).html(), '0', '01'); 225 223 $('.fc-button-year').click(); 226 224 }); … … 278 276 -----------------------------------------------------------------*/ 279 277 $(".button.add.add-event").click(function(event){ 278 var startEvent = new Date(); 279 if(startEvent.toString('mm') < 30) 280 startEvent.add({minutes: 30 - parseInt(startEvent.toString('mm'))}); 281 else 282 startEvent.add({hours: 1, minutes: '-'+startEvent.toString('mm')}); 283 var endEvent = function(date){ 284 if(!!User.preferences.defaultCalendar){ 285 return Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration != "" ? 286 (parseInt(date.getTime()) + Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) 287 : (User.preferences.defaultDuration * 60000); 288 }else 289 return parseInt(date.getTime()) + (User.preferences.defaultDuration * 60000); 290 }; 280 291 eventDetails({ 281 startTime: $.now(), 282 endTime:!!User.preferences.defaultCalendar ? Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration != "" ? ($.now() + Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration * 60000) : (User.preferences.defaultDuration * 60000) 283 : $.now() + (User.preferences.defaultDuration * 60000) 292 startTime: startEvent.getTime(), 293 endTime: endEvent(startEvent) 284 294 }, true ); 285 295 }); … … 309 319 month: 'MMMM yyyy', 310 320 week: "dd[ yyyy] { 'a'[ MMM] dd 'de' MMMM '-' yyyy}", 311 day: 'dddd, dd MMM 321 day: 'dddd, dd MMM, yyyy' 312 322 }, 313 323 columnFormat:{ … … 317 327 }, 318 328 monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ], 319 monthNamesShort: ['Jan','Fev','Mar','Abr','Mai o','Jun','Jul','Ago','Set','Out','Nov','Dez'],329 monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'], 320 330 dayNames: [ 'Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'], 321 331 dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'], -
trunk/prototype/modules/calendar/js/calendar.codecs.js
r5376 r5381 177 177 //DataLayer.poll( "schedulable" ); 178 178 179 DataLayer.listen( "schedulable", function( status 179 DataLayer.listen( "schedulable", function( status, updateData){ 180 180 181 181 if( status === 'serverclient' ){ … … 193 193 pageselectCallback("", 0); 194 194 }); 195 } 195 } 196 196 }); 197 197 -
trunk/prototype/modules/calendar/js/helpers.js
r5376 r5381 214 214 canDiscardEventDialog = true; 215 215 UI.dialogs.addEvent.dialog('close'); 216 }else{ 217 zebraDiscardEventDialog = false; 216 218 } 217 219 … … 243 245 var tabs = UI.dialogs.addEvent.children('.content').tabs(); 244 246 var calendar = DataLayer.get('calendar', objEvent.calendar); 245 246 247 UI.dialogs.addEvent.find(':input').change(function(event){ 248 if (event.keyCode != '27' && event.keyCode != '13') 249 canDiscardEventDialog = false; 250 }).keydown(function(event){ 251 if (event.keyCode != '27' && event.keyCode != '13') 252 canDiscardEventDialog = false; 253 }); 254 247 255 248 if (calendar.timezone != objEvent.timezone){ 256 249 UI.dialogs.addEvent.find('.calendar-addevent-details-txt-timezone').find('option[value="'+objEvent.timezone+'"]').attr('selected','selected').trigger('change'); … … 275 268 } 276 269 }); 270 271 /*Seleciona a agenda padrão para criação de um evento*/ 272 UI.dialogs.addEvent.find('option[value="'+User.preferences.defaultCalendar+'"]').attr('selected','selected').trigger('change'); 277 273 278 274 /*Adicionar alarms padrões, quando alterado a agenda do usuário*/ … … 497 493 var isValidMail = newAttendeeEmail.match(/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/); 498 494 if (!isValidMail) { 499 currentTip.find('.messages').removeClass('hidden').find('.message label'). append('Email inválido.');495 currentTip.find('.messages').removeClass('hidden').find('.message label').html('Email inválido.'); 500 496 return false; 501 497 } … … 770 766 }); 771 767 }); 768 UI.dialogs.addEvent.find(':input').change(function(event){ 769 if (event.keyCode != '27' && event.keyCode != '13') 770 canDiscardEventDialog = false; 771 }).keydown(function(event){ 772 if (event.keyCode != '27' && event.keyCode != '13') 773 canDiscardEventDialog = false; 774 }); 775 772 776 UI.dialogs.addEvent.dialog('open'); 773 777 }); … … 1058 1062 function remove_calendar(){ 1059 1063 /* Pode ser assim $('.cal-list-options-btn.ui-state-active').attr('class').replace(/[a-zA-Z-]+/g, ''); */ 1060 $.Zebra_Dialog('Todos os eventos desta agenda serão apagados. Deseja prosseguir com a operação?', {1064 $.Zebra_Dialog('Todos os eventos desta agenda serão removidos. Deseja prosseguir com a operação?', { 1061 1065 'type': 'question', 1062 1066 'overlay_opacity': '0.5', … … 1217 1221 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-e"); 1218 1222 }); 1219 1223 1220 1224 $(".signed-calendars a.title-signed-calendars").click(function() { 1221 1225 $(".signed-calendars ul.signed-list-calendars").toggleClass( "hidden"); … … 1273 1277 1274 1278 function paginatorSearch(currentView){ 1275 if(parseInt($(currentView+' [name = results]').val()) > 25){ 1276 $(currentView+' .header-paginator .fc-header-left .fc-button.fc-button-next .fc-button-inner').hover( 1277 function(){ 1278 $(this).addClass('fc-state-hover'); 1279 }, 1280 function(){ 1281 $(this).removeClass('fc-state-hover'); 1282 }).mousedown(function(){ 1283 $(this).addClass('fc-state-down'); 1284 }).mouseup(function(){ 1285 $(this).removeClass('fc-state-down'); 1286 $('.events-list.events-list-win.active').removeClass('active'); 1287 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($('[name = page_index]').val())) +1)); 1288 }); 1289 } 1290 if(parseInt($(currentView+' [name = page_index]').val()) > 0){ 1291 $(currentView+' .header-paginator .fc-header-left .fc-button.fc-button-prev .fc-button-inner').hover( 1292 function(){ 1293 $(this).addClass('fc-state-hover'); 1294 }, 1295 function(){ 1296 $(this).removeClass('fc-state-hover'); 1297 }).mousedown(function(){ 1298 $(this).addClass('fc-state-down'); 1299 }).mouseup(function(){ 1300 $(this).removeClass('fc-state-down'); 1301 $('.events-list.events-list-win.active').removeClass('active'); 1302 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($('[name = page_index]').val())) -1)); 1303 }); 1304 } 1279 $(currentView+' .header-paginator .fc-header-left .fc-button').hover( 1280 function(){ 1281 $(this).addClass('fc-state-hover'); 1282 }, 1283 function(){ 1284 $(this).removeClass('fc-state-hover'); 1285 }).mousedown(function(){ 1286 $(this).addClass('fc-state-down'); 1287 }).mouseup(function(){ 1288 $(this).removeClass('fc-state-down'); 1289 $('.events-list.events-list-win.active').removeClass('active'); 1290 var paginator = $(this).attr('class'); 1291 if(paginator.indexOf('next') > 0){ 1292 if(parseInt($(currentView+' [name = results]').val()) > 25) 1293 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) +1)); 1294 }else{ 1295 if(parseInt($(currentView+' [name = page_index]').val()) > 0) 1296 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) -1)); 1297 } 1298 }); 1305 1299 } 1306 1300 … … 1337 1331 $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right .fc-button-'+((view == 'day' || view == 'week') ? 'agenda'+view : view )).addClass('fc-state-active'); 1338 1332 $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right').addClass('list-right'); 1339 $(currentView+' .header-paginator .fc-header-right .fc-button-agendaday').hover( 1333 1334 $(currentView+' .header-paginator .fc-header-right .fc-button').hover( 1340 1335 function(){ 1341 1336 $(this).addClass('fc-state-hover'); … … 1347 1342 $(this).addClass('fc-state-active'); 1348 1343 }).mouseup(function(){ 1349 pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'day'); 1350 }); 1351 1352 $(currentView+' .header-paginator .fc-header-right .fc-button-agendaweek').hover( 1353 function(){ 1354 $(this).addClass('fc-state-hover'); 1355 }, 1356 function(){ 1357 $(this).removeClass('fc-state-hover'); 1358 }).mousedown(function(){ 1359 $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right .fc-button').removeClass('fc-state-active') 1360 $(this).addClass('fc-state-active'); 1361 }).mouseup(function(){ 1362 pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'week'); 1363 }); 1364 1365 $(currentView+' .header-paginator .fc-header-right .fc-button-month').hover( 1366 function(){ 1367 $(this).addClass('fc-state-hover'); 1368 }, 1369 function(){ 1370 $(this).removeClass('fc-state-hover'); 1371 }).mousedown(function(){ 1372 $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right .fc-button').removeClass('fc-state-active') 1373 $(this).addClass('fc-state-active'); 1374 }).mouseup(function(){ 1375 pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'month'); 1376 }); 1377 1378 $(currentView+' .header-paginator .fc-header-right .fc-button-year').hover( 1379 function(){ 1380 $(this).addClass('fc-state-hover'); 1381 }, 1382 function(){ 1383 $(this).removeClass('fc-state-hover'); 1384 }).mousedown(function(){ 1385 $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right .fc-button').removeClass('fc-state-active') 1386 $(this).addClass('fc-state-active'); 1387 }).mouseup(function(){ 1388 pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'year'); 1389 }); 1390 1391 1392 $(currentView+' .header-paginator .fc-header-left .fc-button.fc-button-next .fc-button-inner').hover( 1344 var goView = $(this).attr('class'); 1345 if(goView.indexOf('agendaDay') > 0) 1346 pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'day'); 1347 else if(goView.indexOf('month') > 0) 1348 pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'month'); 1349 else if(goView.indexOf('year') > 0) 1350 pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'year'); 1351 else if(goView.indexOf('agendaWeek') > 0) 1352 pageselectCallback($(currentView+' [name = keyword]').val(), 0, '', 'week'); 1353 1354 }); 1355 1356 $(currentView+' .header-paginator .fc-header-left .fc-button').hover( 1393 1357 function(){ 1394 1358 $(this).addClass('fc-state-hover'); … … 1400 1364 }).mouseup(function(){ 1401 1365 $(this).removeClass('fc-state-down'); 1402 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($('[name = page_index]').val())) +1), '', view); 1403 }); 1404 1405 $(currentView+' .header-paginator .fc-header-left .fc-button.fc-button-prev .fc-button-inner').hover( 1406 function(){ 1407 $(this).addClass('fc-state-hover'); 1408 }, 1409 function(){ 1410 $(this).removeClass('fc-state-hover'); 1411 }).mousedown(function(){ 1412 $(this).addClass('fc-state-down'); 1413 }).mouseup(function(){ 1414 $(this).removeClass('fc-state-down'); 1415 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($('[name = page_index]').val())) -1), '', view); 1416 }); 1366 var paginator = $(this).attr('class'); 1367 if(paginator.indexOf('next') > 0) 1368 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($('[name = page_index]').val())) +1), '', view); 1369 else 1370 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($('[name = page_index]').val())) -1), '', view); 1371 }); 1417 1372 } 1418 1373 … … 1508 1463 $(this).siblings("div.details-event-list").toggleClass("hidden") 1509 1464 .find('.button.delete').click(function(){ 1510 DataLayer.remove('schedulable', $(this).siblings('[name="eventid"]').val()); 1465 var eventId = $(this).siblings('[name="eventid"]').val(); 1466 $.Zebra_Dialog('Tem certeza que deseja excluir o evento?', { 1467 'type': 'question', 1468 'overlay_opacity': '0.5', 1469 'buttons': ['Sim', 'Não'], 1470 'onClose': function(clicked) { 1471 if(clicked == 'Sim'){ 1472 DataLayer.remove('schedulable', eventId); 1473 } 1474 } 1475 }); 1511 1476 }) 1512 1477 .end().find('.button.edit').click(function(){ … … 1533 1498 } 1534 1499 1535 function show_modal_import_export(tab ) {1500 function show_modal_import_export(tab, calendarId) { 1536 1501 DataLayer.render( 'templates/import_export.ejs', {calendars: Calendar.calendars, owner: User.me.id}, function( html ){ 1537 1502 … … 1554 1519 UI.dialogs.importCalendar.find('.button').button(); 1555 1520 1521 tabsImportExport.find('option[value="'+calendarId+'"]').attr('selected','selected').trigger('change'); 1522 1523 1556 1524 UI.dialogs.importCalendar.find(".menu-import-event") 1557 .children(".import").click(function(){ 1558 1559 $('.import-event-form', UI.dialogs.importCalendar).submit(); 1525 .children(".import").click(function(data){ 1526 $('.import-event-form', UI.dialogs.importCalendar).submit(); 1560 1527 UI.dialogs.importCalendar.dialog("close"); 1561 1528 /** -
trunk/prototype/modules/calendar/templates/calendar_list.ejs
r5341 r5381 29 29 <ul> 30 30 <li><a href="#" onclick="add_tab_configure_calendar(<%= agendas_usuario[i].id%>);">Configurações</a></li> 31 <li><a href="#" onclick="show_modal_import_export(0 );">Importar</a></li>32 <li><a href="#" onclick="show_modal_import_export(1 );">Exportar</a></li>31 <li><a href="#" onclick="show_modal_import_export(0, <%= agendas_usuario[i].id%>);">Importar</a></li> 32 <li><a href="#" onclick="show_modal_import_export(1, <%= agendas_usuario[i].id%>);">Exportar</a></li> 33 33 <li><a href="#" onclick="remove_calendar();">Remover agenda</a></li> 34 34 </ul>
Note: See TracChangeset
for help on using the changeset viewer.