Changeset 7228 for branches/2.4/prototype/modules/calendar/js/init.js
- Timestamp:
- 09/17/12 14:30:47 (12 years ago)
- Location:
- branches/2.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4
- Property svn:mergeinfo changed
-
branches/2.4/prototype/modules/calendar/js/init.js
r6754 r7228 147 147 }, true ); 148 148 }); 149 150 var currentToolTip = null; 151 $('#divAppbox').on('scroll',function(){ 152 if ($(".new-task").length) 153 currentToolTip.qtip('destroy'); 154 }); 155 156 /* Quick add task 157 -----------------------------------------------------------------*/ 158 $(".button.add.add-task").click(function(event){ 159 currentToolTip = $(this); 160 var componente = $(this); 161 162 if(!$('div.qtip.qtip-blue.new-task').length){ 163 164 $('div.qtip.qtip-blue').remove(); 165 166 $(componente).qtip({ 167 show: { 168 ready: true, 169 solo: true, 170 when: { 171 event: 'click' 172 } 173 }, 174 hide: false, 175 content: { 176 text: $('<div></div>').html( DataLayer.render( 'templates/task_quick_add.ejs', {"componente" : componente} ) ), 177 title: { 178 text:'Nova Tarefa', 179 button: '<a class="button close" href="#">close</a>' 180 } 181 }, 182 style: { 183 name: 'blue', 184 tip: { 185 corner: 'leftMiddle' 186 }, 187 border: { 188 width: 4, 189 radius: 8 190 }, 191 width: { 192 min: 225, 193 max:225 194 } 195 }, 196 position: { 197 corner: { 198 target: 'rightMiddle', 199 tooltip: 'leftMiddle' 200 }, 201 adjust: { 202 x:0, 203 y:0 204 } 205 } 206 }) 207 .qtip("api").onShow = function(arg0) { 208 209 /*------------------------------------------------------------------------*/ 210 /* Seta os valores padrões nos inputs do qtip */ 211 $('div.qtip div.add-simple-task input.task').Watermark("Tarefa sem título"); 212 $('div.qtip div.add-simple-task textarea').Watermark("Descrição"); 213 /*------------------------------------------------------------------------*/ 214 215 $('.qtip-active .button.close').button({ 216 icons: { 217 primary: "ui-icon-close" 218 }, 219 text: false 220 }) 221 .click(function(){ 222 $(componente).qtip('destroy'); 223 }); 224 225 $('.qtip-active .button.save').button().click(function(){ 226 227 var title = $('div.qtip div.add-simple-task input.task').val(); 228 var description = $('div.qtip div.add-simple-task textarea').val(); 229 230 var calendar, timezone = ''; 231 232 for (var i = 0; i < Calendar.signatures.length; i++){ 233 if(Calendar.signatures[i].type == 1 && Calendar.signatures[i].calendar.type == 1){ 234 calendar = Calendar.signatures[i].calendar.id; 235 timezone = Calendar.signatures[i].calendar.timezone; 236 break; 237 } 238 } 239 240 DataLayer.put('schedulable', 241 { 242 summary: title, 243 description: description, 244 type: '2', 245 calendar: calendar, 246 timezone: timezone, 247 'class':'1', 248 status: '1', 249 startTime: new Date().toString('yyyy-MM-dd 00:00:00'), 250 endTime: new Date().toString('yyyy-MM-dd 00:00:00'), 251 allDay: '1', 252 priority: '1', 253 participants: 254 [{ 255 user: User.me.id, 256 isOrganizer: 1, 257 acl: 'row' 258 }] 259 }); 260 261 $(componente).qtip('destroy'); 262 263 }); 264 265 $('.qtip-active .button.advanced').button().click(function(){ 266 267 var startEvent = new Date(); 268 var configData = (startEvent.toString('mm') < 30) ? {minutes: (30 - parseInt(startEvent.toString('mm')))} : {hours: 1, minutes: '-'+startEvent.toString('mm')}; 269 startEvent.add(configData); 270 271 var componente = $(this); 272 var description = $('div.qtip div.add-simple-task textarea[name="description"]').val(); 273 274 taskDetails({ 275 summary: $('div.qtip div.add-simple-task input[name="summary"]').val(), 276 description: description == 'Descrição' ? '' : description, 277 startTime: startEvent.getTime(), 278 endTime: dateCalendar.decodeRange(startEvent, (!!User.preferences.defaultCalendar ? ( !!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ? 279 (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration) : (User.preferences.defaultDuration)) : (User.preferences.defaultDuration))) 280 }, true ); 281 282 $(componente).qtip('destroy'); 283 }); 284 285 $('.qtip-active .button.cancel').button().click(function(){ 286 $(componente).qtip('destroy'); 287 }); 288 289 $('.qtip-active .button').button(); 290 291 $('div.qtip.qtip-blue.qtip-active').addClass('new-task'); 292 } 293 } 294 }); 295 296 $(".button.add.add-activity").click(function(event){ 297 var startEvent = new Date(); 298 var configData = (startEvent.toString('mm') < 30) ? {minutes: (30 - parseInt(startEvent.toString('mm')))} : {hours: 1, minutes: '-'+startEvent.toString('mm')}; 299 startEvent.add(configData); 300 301 activityDetails({ 302 startTime: startEvent.getTime(), 303 endTime: dateCalendar.decodeRange(startEvent, (!!User.preferences.defaultCalendar ? ( !!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ? 304 (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration) : (User.preferences.defaultDuration)) : (User.preferences.defaultDuration))) 305 }, true ); 306 307 }); 149 308 150 309 var calendar = $('#calendar').fullCalendar(DataLayer.merge({ … … 189 348 year: 'ano' 190 349 }, 191 /* 350 192 351 eventRender: function( event, element, view ){ 193 $(element).attr( 'event-id', event.id ); 194 }, 195 */ 352 $('#calendar td.fc-year-have-event').removeClass('fc-year-have-event'); 353 354 var img_icon = ""; 355 if(event.type == 1) 356 img_icon = "mini-event.png"; 357 if(event.type == 2) 358 img_icon = "mini-task.png"; 359 if(event.type == 3) 360 img_icon = "mini-activity.png"; 361 362 363 element.find(".fc-event-inner.fc-event-skin").prepend($('<img style="width: 11px; height: 13px;" class="" src="../prototype/modules/calendar/img/' + img_icon + '"></img>')); 364 }, 365 196 366 select: function( start, end, allDay, event, view ){ 197 367 if (view.name == "month") { … … 285 455 eventClick: function( evt, event, view ){ 286 456 evt.id = evt.id.split('-')[0]; 287 if(evt.selectable){288 if(evt.isRepeat){289 $.Zebra_Dialog(evt.title + ' é um evento com repetição.', {290 'type': 'question',291 'overlay_opacity': '0.5',292 'buttons': ['Editar todas ocorrências', 'Editar essa ocorrência'],293 'onClose': function(clicked) {294 if(clicked == 'Editar todas ocorrências') {295 eventDetails( DataLayer.get( "schedulable", evt.id), true);296 }else{297 /*298 * TODO - repeat foi adicionado pois melhorias devem ser feitas no rollback do299 *DataLayer, repeat somente é usado quando se trata da criação de um evento300 *pela edição de uma ocorrência.301 */302 var repeat = mount_exception(evt.id, evt.occurrence);303 304 $('.calendar-copy-move input[name="typeEvent"]').val("3");305 306 eventDetails(copyAndMoveTo(false , evt.id , false, "3", evt), true, '', false, repeat);307 }308 }309 });310 311 }else{312 var schedulable = DataLayer.get( "schedulable", evt.id);313 schedulable.calendar = evt.calendar; 314 eventDetails( schedulable, true);315 316 } 317 457 458 switch (parseInt(evt.type)){ 459 case 1: 460 if(evt.selectable){ 461 if(evt.isRepeat){ 462 $.Zebra_Dialog(evt.title + ' é um evento com repetição.', { 463 'type': 'question', 464 'overlay_opacity': '0.5', 465 'buttons': ['Editar todas ocorrências', 'Editar essa ocorrência'], 466 'onClose': function(clicked) { 467 if(clicked == 'Editar todas ocorrências') { 468 eventDetails( DataLayer.get( "schedulable", evt.id), true); 469 }else{ 470 /* 471 * TODO - repeat foi adicionado pois melhorias devem ser feitas no rollback do 472 *DataLayer, repeat somente é usado quando se trata da criação de um evento 473 *pela edição de uma ocorrência. 474 */ 475 var repeat = mount_exception(evt.id, evt.occurrence); 476 477 $('.calendar-copy-move input[name="typeEvent"]').val("3"); 478 479 eventDetails(copyAndMoveTo(false , evt.id , false, "3", evt), true, '', false, repeat); 480 } 481 } 482 }); 483 }else{ 484 var schedulable = DataLayer.get( "schedulable", evt.id); 485 schedulable.calendar = evt.calendar; 486 eventDetails( schedulable, true); 487 } 318 488 } 489 break; 490 case 2: 491 var task = DataLayer.get( "schedulable", evt.id); 492 task.group = evt.calendar; 493 taskDetails( task, true); 494 break; 495 case 3: 496 var activity = DataLayer.get( "schedulable", evt.id); 497 activity.group = evt.calendar; 498 activityDetails( activity, true); 499 break; 500 } 319 501 }, 320 502 … … 322 504 contentMenu(); 323 505 } 324 }, dateCalendar)); 325 506 }, dateCalendar)); 507 508 326 509 contentMenu(); 327 510 … … 346 529 }); 347 530 //Todo chamada do metodo que adiciona ao full calendar o botao de listagem de eventos 348 //listEvents();531 printEvents(); 349 532 }); 533 534 535 function useDesktopNotification(){ 536 return !!parseInt(User.preferences.useDesktopNotification); 537 }
Note: See TracChangeset
for help on using the changeset viewer.