Index: sandbox/2.4.2-expresso1/prototype/modules/calendar/css/layout.css
===================================================================
--- sandbox/2.4.2-expresso1/prototype/modules/calendar/css/layout.css	(revision 6797)
+++ sandbox/2.4.2-expresso1/prototype/modules/calendar/css/layout.css	(revision 6811)
@@ -723,4 +723,5 @@
 .lbl-archive-nome{width:40px !important;}
 .row.fileupload-buttonbar{margin-top: -14px; padding: 0.2em 0.7em;}
+.row.fileupload-buttonbar-task{margin-top: 0; padding: 0.2em 0.7em;}
 
 .archive-nome{width: 73px;}
@@ -898,4 +899,7 @@
 }
 
+.new-event-win div.div-addtask { padding: 0; width: 770px; border: 0;}
+.new-event-win form.form-addevent { padding: 9px; }
+
 .ui-dialog .ui-dialog-content { padding: 0; }
 .new-event-win div.div-addevent { padding: 0; width: 700px; border: 0;}
Index: sandbox/2.4.2-expresso1/prototype/modules/calendar/css/style.css
===================================================================
--- sandbox/2.4.2-expresso1/prototype/modules/calendar/css/style.css	(revision 6797)
+++ sandbox/2.4.2-expresso1/prototype/modules/calendar/css/style.css	(revision 6811)
@@ -462,2 +462,47 @@
 	color: transparent;
 }
+
+.div-addtask #calendar_addtask_details1 .h1{
+  width: 100%;
+}
+
+.div-addtask #calendar_addtask_details2 textarea {
+  width: 670px;
+}
+
+.div-addtask{
+  width: 760px;
+}
+
+.div-addtask #calendar_addtask_details1 .time-previsao { width: 40px; }
+
+.div-addtask #calendar_addtask_details1 .date-previsao{ width: 80px; }
+
+.div-addtask #calendar_addtask_details1 .start-time{ width: 40px; }
+.div-addtask #calendar_addtask_details1 .start-date{ width: 80px; }
+.div-addtask #calendar_addtask_details1 .end-time{ width: 40px; }
+.div-addtask #calendar_addtask_details1 .end-date{ width: 80px; }
+.div-addtask #calendar_addtask_details1 .previsao-termino { margin: 0 0 0 50px; }
+.div-addtask #calendar_addtask_details1 .subitem { margin: 5px; display: block;}
+.div-addtask #calendar_addtask_details1 .subitem .span_done{ margin: 0 30px;}
+.div-addtask #calendar_addtask_details1 .calendar_addevent_details_lnk_timezone { margin: 0 0 0 20px;}
+.div-addtask #calendar_addtask_details1 .subitem .done { width: 45px;}
+
+
+.div-addtask  #calendar_addtask_details8 .parent {width: 725px; min-height: 278px; float: left;}
+.div-addtask  #calendar_addtask_details8 .parent .child-top {width: 745px; height: 30px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom {width: 745px; height: 278px; overflow: auto;  float: left; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each { height: 30px; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each:hover { background: #FFF2F2; cursor: pointer;}
+
+
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour { width: 30%; float: left; height: 30px}
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour span { margin: 8px; float: left; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .organization{ width: 69%; float: left;  height: 30px; border-left: 1px solid #CCC; }
+.div-addtask  #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .organization span{ margin: 8px; float: left; }
+
+
+.div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour { width: 29%; float: left; background: #E8F4FD; height: 30px; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .date-hour span{ margin: 8px; float: left; font-weight: bold; color: #2E6E9E; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .organization { width: 70%; float: left; background: #E8F4FD; height: 30px; border-left: 1px solid #CCC; font-weight: bold; color: #2E6E9E; }
+.div-addtask  #calendar_addtask_details8 .parent .child-top .organization span{margin: 8px; float: left; }
Index: sandbox/2.4.2-expresso1/prototype/modules/calendar/js/task.helpers.js
===================================================================
--- sandbox/2.4.2-expresso1/prototype/modules/calendar/js/task.helpers.js	(revision 6811)
+++ sandbox/2.4.2-expresso1/prototype/modules/calendar/js/task.helpers.js	(revision 6811)
@@ -0,0 +1,589 @@
+function taskDetails( objEvent, decoded, path, isMail, repeat){
+
+    attendees = {};
+	
+    if(path == undefined)
+	path = "";
+		
+    if( !decoded )
+	objEvent = DataLayer.decode( "schedulable:calendar", objEvent );
+
+    if(!isMail)
+	objEvent = DataLayer.encode( "schedulable:preview", objEvent );
+	
+    if(typeof(objEvent.id) == 'undefined'){
+	objEvent.alarms = Calendar.signatureOf[User.preferences.defaultCalendar || Calendar.calendarIds[0]].defaultAlarms || false;
+	objEvent.useAlarmDefault = 1;
+    }
+	
+    /**
+	 * canDiscardEventDialog deve ser true se não houver alterações no evento
+	 */
+    canDiscardEventDialog = true;
+    /**
+	 * zebraDiscardEventDialog é uma flag indicando que uma janela de confirmação (Zebra_Dialog)
+	 * já está aberta na tela, uma vez que não é possivel acessar o evento ESC utilizado para fechá-la
+	 */
+    zebraDiscardEventDialog = false;
+	
+    /**
+		ACLs do participant
+	*/
+    acl_names = {
+	'w': 'acl-white',
+	'i': 'acl-invite-guests',
+	'p': 'acl-participation-required'
+    };
+
+    var dependsDelegate = function(reference, inverse){
+	if(inverse){
+	    if(reference.find('input[name="attendee[]"]').val() == blkAddAtendee.find('li.organizer input[name="attendee_organizer"]').val())
+		blkAddAtendee.find('li.organizer input[name="attendee_organizer"]').val(blkAddAtendee.find('.me input[name="attendee[]"]').val());
+	}else{
+	    if(blkAddAtendee.find('.me input[name="attendee[]"]').val() == blkAddAtendee.find('li.organizer input[name="attendee_organizer"]').val())
+		blkAddAtendee.find('li.organizer input[name="attendee_organizer"]').val(reference.find('input[name="attendee[]"]').val());
+	}
+	
+    };
+    
+    var removeOthers = function(){
+	var other = blkAddAtendee.find('.delegate.attendee-permissions-change-button');
+	if(other.lenght){
+	    dependsDelegate(other.parents('li'), true);
+	}
+	blkAddAtendee.find('.delegate').removeClass('attendee-permissions-change-button');
+	blkAddAtendee.find('.ui-icon-transferthick-e-w').removeClass('attendee-permissions-change');
+	
+    };
+	
+	var html = DataLayer.render( path+'templates/task_add.ejs', {
+	    event:objEvent
+	});	
+			
+	if (!UI.dialogs.addTask) {
+
+	    UI.dialogs.addTask = jQuery('#sandbox').append('<div title="Criar tarefa" class="new-event-win active"> <div>').find('.new-event-win.active').html(html).dialog({
+		resizable: false, 
+		modal:true, 
+		autoOpen: false,
+		width:774, 
+		position: 'center', 
+		close: function(event, ui) {
+			/**
+			 * Remove tooltip possivelmente existente
+			 */
+			if ($('.qtip.qtip-blue.qtip-active').length)
+				$('.qtip.qtip-blue.qtip-active').qtip('destroy');						
+			attendees  = {};
+		},
+		beforeClose: function(event, ui) {
+		
+		    if (!canDiscardEventDialog && !zebraDiscardEventDialog) {
+			zebraDiscardEventDialog = true;
+			window.setTimeout(function() {
+			    $.Zebra_Dialog('Suas alterações no evento não foram salvas. Deseja descartar as alterações?', {
+				'type':     'question',
+				'overlay_opacity': '0.5',
+				'buttons':  ['Descartar alterações', 'Continuar editando'],
+				'onClose':  function(clicked) {
+				    if(clicked == 'Descartar alterações') {
+					canDiscardEventDialog = true;
+					/**
+					*Remoção dos anexos do eventos caso seja cancelado a edição
+					*/
+					DataLayer.rollback();
+
+					var ids = false;
+					$.each($('.attachment-list input'), function (i, input) {
+					    DataLayer.put('attachment', {id: ''+input.value});
+					    DataLayer.remove('attachment', ''+input.value);
+						ids = true;
+					});
+					if(ids)
+						DataLayer.commit();
+				
+					
+	                                                                                
+					UI.dialogs.addTask.dialog('close');
+				    }else{
+					zebraDiscardEventDialog = false;
+				    }
+										
+				    /**
+				    * Uma vez aberta uma janela de confirmação (Zebra_Dialog), ao fechá-la
+				    * com ESC, para que o evento ESC não seja propagado para fechamento da
+				    * janela de edição de eventos, deve ser setada uma flag indicando que
+				    * já existe uma janela de confirmação aberta.
+				    */
+				    if (!clicked) {
+					window.setTimeout(function() {
+					    zebraDiscardEventDialog = false;
+					}, 200);
+				    }
+				}
+			    });
+								
+			}, 300);
+
+		    }
+		    //DataLayer.rollback();
+		    return canDiscardEventDialog;
+		},
+		dragStart: function(event, ui) {
+			if ($('.qtip.qtip-blue.qtip-active').length)
+				$('.qtip.qtip-blue.qtip-active').qtip('destroy');
+		}
+	    });
+				
+	} else {
+	    UI.dialogs.addTask.html(html);
+	}
+		
+var tabs = UI.dialogs.addTask.children('.content').tabs({
+	select: function(event, ui) { 
+		if ($('.qtip.qtip-blue.qtip-active').length)
+			$('.qtip.qtip-blue.qtip-active').qtip('destroy');
+	}	
+	});
+var calendar = DataLayer.get('calendar', objEvent.calendar);
+				
+if (calendar.timezone != objEvent.timezone){
+    UI.dialogs.addTask.find('.calendar-addevent-details-txt-timezone').find('option[value="'+objEvent.timezone+'"]').attr('selected','selected').trigger('change');
+    UI.dialogs.addTask.find('.calendar_addevent_details_lnk_timezone').addClass('hidden');
+    $('.calendar-addevent-details-txt-timezone').removeClass('hidden');
+			
+}
+
+UI.dialogs.addTask.find('.calendar_addevent_details_lnk_timezone').click(function(e){
+    $(this).addClass('hidden');
+    $('.calendar-addtask-details-txt-timezone').removeClass('hidden');
+    e.preventDefault();
+});
+
+/*Seleciona a agenda padrão para visualização/edição de um evento*/
+if(objEvent.id)
+    UI.dialogs.addTask.find('option[value="'+objEvent.calendar+'"]').attr('selected','selected').trigger('change');
+
+/* Checkbox allday */
+
+UI.dialogs.addTask.find('input[name="allDay"]').click(function(){
+    $(this).attr("checked") ? 
+    UI.dialogs.addTask.find('.start-time, .end-time').addClass('hidden') :
+    UI.dialogs.addTask.find('.start-time, .end-time').removeClass('hidden'); 
+    updateMap(true);
+});
+
+UI.dialogs.addTask.find('.button').button();
+UI.dialogs.addTask.find('.button.add').button({
+    icons: {
+	secondary: "ui-icon-plus"
+    }
+});
+
+// ==== validation events ====
+UI.dialogs.addTask.find(".input-group .h1").Watermark("Tarefa sem título");
+if(User.preferences.hourFormat.length == 5) {
+    UI.dialogs.addTask.find(".end-time, .start-time").mask("99:99", {
+	completed: function(){
+	    updateMap();
+	}
+    });
+} else {
+    $.mask.definitions['{']='[ap]';
+    $.mask.definitions['}']='[m]';
+    UI.dialogs.addTask.find(".end-time, .start-time").mask("99:99 {}", {
+	completed:function(){
+	    $(this).val(date.Calendar.defaultToAmPm($(this).val()));
+	    $(this).timepicker("refresh");
+	    $(this).val($(this).val().replace(/[\.]/gi, ""));
+	    updateMap();
+	}
+    });
+}
+UI.dialogs.addTask.find(".number").numeric();
+User.preferences.dateFormat.indexOf('-') > 0 ? 
+UI.dialogs.addTask.find(".date").mask("99-99-9999", {
+    completed:function(){
+	updateMap();
+    }
+}) : 
+UI.dialogs.addTask.find(".date").mask("99/99/9999", {
+    completed:function(){
+	updateMap();
+    }
+});
+
+UI.dialogs.addTask.find(".menu-addtask")
+.children(".delete").click(function(){
+    $.Zebra_Dialog('Tem certeza que deseja excluir o evento?', {
+	'type':     'question',
+	'overlay_opacity': '0.5',
+	'buttons':  ['Sim', 'Não'],
+	'onClose':  function(clicked) {
+	    if(clicked == 'Sim'){
+		canDiscardEventDialog = true;
+		/* Remove por filtro */
+		DataLayer.removeFilter('schedulable', {filter: ['AND', ['=', 'id', objEvent.id], ['=', 'calendar', objEvent.calendar], ['=','user',(objEvent.me.user ? objEvent.me.user.id : objEvent.me.id)]]});
+		Calendar.rerenderView(true);
+		/********************/
+		UI.dialogs.addTask.dialog("close");
+	    }
+	}
+    });
+}).end()
+	    
+.children(".cancel").click(function(){
+    UI.dialogs.addTask.dialog("close");
+}).end()
+	    
+.children(".save").click(function(){
+    /* Validação */
+    var msg = false;			
+    if(msg = validDateEvent()){
+	$(".new-event-win.active").find('.messages-validation').removeClass('hidden').find('.message label').html(msg); 
+	return false;
+    }
+			
+    canDiscardEventDialog = true;
+			
+    var exit = function(event){
+	if(event)
+	    DataLayer.remove('schedulable', event, false); 
+
+	UI.dialogs.addTask.children().find('form.form-addevent').submit();
+	UI.dialogs.addTask.dialog("close");    }
+                        
+    if(repeat){
+	DataLayer.remove('repeat', false);
+	DataLayer.put('repeat', repeat);
+	DataLayer.commit('repeat', false, exit(repeat.schedulable));
+    }else
+	exit();
+}).end()
+		
+.children(".export").click(function(){
+    UI.dialogs.addTask.children().find(".form-export").submit();
+});
+
+var attendeeHtml = DataLayer.render( path+'templates/attendee_add.ejs', {
+    event:objEvent
+});		
+	
+// load template of attendees
+var blkAddAtendee = UI.dialogs.addTask.find('#calendar_addtask_details6').append(attendeeHtml);
+
+var dates = UI.dialogs.addTask.find('input.date').datepicker({
+    dateFormat: User.preferences.dateFormat.replace(/M/g, 'm').replace(/yyyy/g, 'yy'),
+    onSelect : function( selectedDate ){
+	updateMap();
+    }
+});
+
+UI.dialogs.addTask.find('input.time').timepicker({ 
+    closeText: 'Ok',
+    hourGrid: 4,
+    minuteGrid: 10,
+    ampm : ((User.preferences.hourFormat.length > 5) ? true: false),
+    timeFormat: "hh:mm tt",
+    onSelect: function (selectedDateTime){
+	if(!(User.preferences.hourFormat.length == 5))
+	    $(this).val(selectedDateTime.replace(/[\.]/gi, ""));								
+	updateMap();
+    },
+    onClose : function (selectedDateTime){
+	if(!(User.preferences.hourFormat.length == 5))
+	    $(this).val(selectedDateTime.replace(/[\.]/gi, ""));
+    }
+	
+
+});
+
+blkAddAtendee.find('.add-attendee-search .ui-icon-search').click(function(event) {
+    blkAddAtendee.find('.add-attendee-search input').keydown();
+});
+			
+			
+blkAddAtendee.find('.add-attendee-search input').keydown(function(event) {
+
+    if(event.keyCode == '13' || typeof(event.keyCode) == 'undefined') {			
+	var result = DataLayer.get('user', ["*", "name", $(this).val()], true);
+
+	/**
+        * TODO: trocar por template
+        */
+	blkAddAtendee.find('ul.search-result-list').empty().css('overflow', 'hidden');
+	if (!result) {
+	    blkAddAtendee.find('ul.search-result-list').append('<li><label class="empty">Nenhum resultado encontrado.</label></li>');
+	}
+
+	for(i=0; i<result.length; i++)
+	    result[i].enabled = (blkAddAtendee.find('dd.attendee-list ul.attendee-list label.mail[title="' +  result[i].mail + '"]').length) ? false : true;
+											
+	blkAddAtendee.find('ul.search-result-list').append(DataLayer.render( path+'templates/participants_search_itemlist.ejs', result));
+
+	blkAddAtendee.find('ul.search-result-list li').click(function(event, ui){
+	    if ($(event.target).is('input')) {
+		old_item = $(event.target).parents('li');
+		newAttendeeId = DataLayer.put('participant', {
+		    user: old_item.find('.id').html(), 
+		    isExternal: old_item.find('.isExternal').html()
+		});
+							
+		attendees[old_item.find('.id').html()] = old_item.find('.name').html();
+							
+		blkAddAtendee.find('dd.attendee-list ul.attendee-list')
+		.append(DataLayer.render(path+'templates/participants_add_itemlist.ejs', [{
+		    id: newAttendeeId, 
+		    name: old_item.find('.name').html(), 
+		    mail: old_item.find('.mail').html(), 
+		    isExternal: old_item.find('.isExternal').html(), 
+		    acl: objEvent.acl,
+		    isDirty: !!!objEvent.id
+		    }]))
+		.scrollTo('max');
+		/**
+							* Delegação de participação de um participante com permissão apenas de leitura
+							*
+							*/
+		if(!objEvent.acl.organization && !objEvent.acl.write && !objEvent.acl.inviteGuests && objEvent.acl.read ){
+								
+		    blkAddAtendee.find('.block-add-attendee.search').addClass('hidden');
+		    blkAddAtendee.find('.block-add-attendee.search dt').html('Adicionar outros contatos');
+								
+		    blkAddAtendee.find('.status option').toggleClass('hidden');
+		    blkAddAtendee.find('option[value=5]').attr('selected','selected').trigger('change');
+		    blkAddAtendee.find('.request-update').removeClass('hidden');
+
+		    blkAddAtendee.find('dd.attendee-list ul.attendee-list li .button.close').parents('li').find('input[name="delegatedFrom[]"]').val(blkAddAtendee.find('.me input[name="attendee[]"]').val());
+								
+		    blkAddAtendee.find('.me .participant-delegate').addClass('disable ui-button-disabled ui-state-disabled');
+		    blkAddAtendee.find(".button.close").button({
+			icons: {
+			    primary: "ui-icon-close"
+			},
+			text: false
+		    }).click(function () {
+									
+			$(this).parents('li').find('input[name="delegatedFrom[]"]').val('');
+			blkAddAtendee.find('.request-update').addClass('hidden');
+			blkAddAtendee.find('.status option').toggleClass('hidden');
+			blkAddAtendee.find('option[value=1]').attr('selected','selected').trigger('change');			
+			blkAddAtendee.find('.me .participant-delegate').removeClass('disable ui-button-disabled ui-state-disabled attendee-permissions-change-button')
+			.find('.ui-icon-person').removeClass('attendee-permissions-change').end();               	
+									
+			DataLayer.remove('participant', $(this).parents('li').find('[type=checkbox]').val());
+			$(this).parents('li').remove();
+		    })
+		    .addClass('tiny');
+		}else{
+		    callbackAttendee();
+		    old_item.remove();
+		}
+	    }
+	});
+
+	event.preventDefault();
+    }
+});
+
+UI.dialogs.addTask.find('.row.fileupload-buttonbar .button').filter('.delete').button({
+    icons: {
+	primary: "ui-icon-close"
+    },
+    text: 'Excluir'
+}).click(function () {
+    $.Zebra_Dialog('Tem certeza que deseja excluir todos anexos?', {
+	'type':     'question',
+	'overlay_opacity': '0.5',
+	'buttons':  ['Sim', 'Não'],
+	'onClose':  function(clicked) {
+	    if(clicked == 'Sim'){
+		
+                var ids = [];
+                $.each($('.attachment-list input'), function (i, input) {
+                     DataLayer.remove('schedulableToAttachment', {
+                        filter: ['=', 'id', ''+input.value]
+                        });
+                });
+                $('.attachment-list input').remove();
+                $('.row.fileupload-buttonbar .attachments-list p').remove();
+            }
+        }});
+}).end()
+.filter('.close').button({
+    icons: {
+	primary: "ui-icon-close"
+    },
+    text: false
+}).click(function () {
+    DataLayer.remove('schedulableToAttachment', $(this).parents('p').find('input[name="fileId[]"]').val());
+    $(this).parents('p').remove();
+}).end()
+.filter('.downlaod-archive').button({
+    icons: {
+	primary: "ui-icon-arrowthickstop-1-s"
+    },
+    text: false
+});
+var maxSizeFile = 2000000;
+$('#fileupload').fileupload({
+    sequentialUploads: true,
+    add: function (e, data) {
+	if(data.files[0].size < maxSizeFile)
+	    data.submit();
+    },
+    change: function (e, data) {
+	$.each(data.files, function (index, file) {
+	    var attach = {};
+	    attach.fileName = file.name;
+	    var ext = file.name.split('.');
+	    if(file.name.length > 10)
+		attach.fileName = ext.length == 1 ? file.name.substr(0, 10) :  file.name.substr(0, 6) + '.' + ext[ext.length -1];
+	    attach.fileSize = formatBytes(file.size);
+	    if(file.size > maxSizeFile)
+		attach.error = 'Tamanho de arquivo nao permitido!!'
+				
+	    $('.attachments-list').append(DataLayer.render(path+'templates/attachment_add_itemlist.ejs', {
+		file : attach
+	    }));
+				
+	    if(file.size < maxSizeFile){
+		$('.fileinput-button.new').append(data.fileInput[0]).removeClass('new');
+		$('.attachments-list').find('[type=file]').addClass('hidden');
+					
+	    }else
+		$('.fileinput-button.new').removeClass('new');
+				
+				
+	    $('.attachments-list').find('.button.close').button({
+		icons: {
+		    primary: "ui-icon-close"
+		},
+		text: false
+	    }).click(function(){
+		var idAttach = $(this).parent().find('input[name="fileId[]"]').val();
+		$('.attachment-list').find('input[value="'+idAttach+'"]')
+		$(this).parent().remove();
+	    });	
+				
+	})
+	},
+    done: function(e, data){
+	var currentUpload = $('.progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide();
+
+	if(!!data.result && data.result != "[]"){
+	    var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data);
+	    $('.attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>');
+	    currentUpload.removeClass('on-complete').parents('p')
+	    .append('<input type="hidden" name="fileId[]" value="'+newAttach['attachment'][0][0].id+'"/>')
+	    .find('.status-upload').addClass('ui-icon ui-icon-check');
+	}else
+	    currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel');
+    }
+});
+$('.attachments-list .button').button();
+
+if(!!window.FormData)			
+$('#fileupload').bind('fileuploadstart', function () {
+    var widget = $(this),
+    progressElement = $('#fileupload-progress').fadeIn(),
+    interval = 500,
+    total = 0,
+    loaded = 0,
+    loadedBefore = 0,
+    progressTimer,
+    progressHandler = function (e, data) {
+	loaded = data.loaded;
+	total = data.total;
+    },
+    stopHandler = function () {
+	widget
+	.unbind('fileuploadprogressall', progressHandler)
+	.unbind('fileuploadstop', stopHandler);
+	window.clearInterval(progressTimer);
+	progressElement.fadeOut(function () {
+	    progressElement.html('');
+	});
+    },
+    formatTime = function (seconds) {
+	var date = new Date(seconds * 1000);
+	return ('0' + date.getUTCHours()).slice(-2) + ':' +
+	('0' + date.getUTCMinutes()).slice(-2) + ':' +
+	('0' + date.getUTCSeconds()).slice(-2);
+    },
+    /* formatBytes = function (bytes) {
+            if (bytes >= 1000000000) {
+                return (bytes / 1000000000).toFixed(2) + ' GB';
+            }
+            if (bytes >= 1000000) {
+                return (bytes / 1000000).toFixed(2) + ' MB';
+            }
+            if (bytes >= 1000) {
+                return (bytes / 1000).toFixed(2) + ' KB';
+            }
+            return bytes + ' B';
+        },*/
+    formatPercentage = function (floatValue) {
+	return (floatValue * 100).toFixed(2) + ' %';
+    },
+    updateProgressElement = function (loaded, total, bps) {
+	progressElement.html(
+	    formatBytes(bps) + 'ps | ' +
+	    formatTime((total - loaded) / bps) + ' | ' +
+	    formatPercentage(loaded / total) + ' | ' +
+	    formatBytes(loaded) + ' / ' + formatBytes(total)
+	    );
+    },
+    intervalHandler = function () {
+	var diff = loaded - loadedBefore;
+	if (!diff) {
+	    return;
+	}
+	loadedBefore = loaded;
+	updateProgressElement(
+	    loaded,
+	    total,
+	    diff * (1000 / interval)
+	    );
+    };
+    widget
+    .bind('fileuploadprogressall', progressHandler)
+    .bind('fileuploadstop', stopHandler);
+    progressTimer = window.setInterval(intervalHandler, interval);
+});
+	
+if(objEvent.isShared){
+		
+    var acls = Calendar.signatureOf[objEvent.calendar].permission.acl;
+		
+    if(!acls.write){
+	UI.dialogs.addTask.find(':input').attr('disabled', 'disabled');
+	UI.dialogs.addTask.find('.button').hide();
+    }
+		
+    if(acls.remove)
+	UI.dialogs.addTask.find('.button.remove').show();
+    
+    UI.dialogs.addTask.find('.button.cancel').show();	
+}
+
+disponibily(objEvent, path, attendees);
+
+UI.dialogs.addTask.find('.button-add-alarms').click(function(){
+    var li_attach = DataLayer.render(path+'templates/alarms_add_itemlist.ejs', {type: 1});
+
+    jQuery('.task-alarms-list').append(li_attach).find('.button.remove').button({
+	text:false, 
+	icons:{
+	    primary:'ui-icon-close'
+	}
+    }).click(function(el) {
+		$(this).parent().remove().find('li').is(':empty')
+	});
+// valicacao de campos numericos
+$('.number').numeric();
+});
+
+
+UI.dialogs.addTask.dialog('open');
+}
Index: sandbox/2.4.2-expresso1/prototype/modules/calendar/js/init.js
===================================================================
--- sandbox/2.4.2-expresso1/prototype/modules/calendar/js/init.js	(revision 6797)
+++ sandbox/2.4.2-expresso1/prototype/modules/calendar/js/init.js	(revision 6811)
@@ -244,6 +244,19 @@
 
 			    $('.qtip-active .button.advanced').button().click(function(){
-			    	$(componente).qtip('destroy');
-			    	alert('Nova Tela de criação tarefas');
+			    	
+					$(componente).qtip('destroy');
+					
+			    	var startEvent = new Date();
+					var configData = (startEvent.toString('mm') < 30)  ? {minutes: (30 - parseInt(startEvent.toString('mm')))} : {hours: 1, minutes: '-'+startEvent.toString('mm')};
+					startEvent.add(configData); 
+			
+						var componente = $(this);
+
+					taskDetails({ 
+						startTime: startEvent.getTime(),
+						endTime: dateCalendar.decodeRange(startEvent, (!!User.preferences.defaultCalendar ? (	!!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ?  
+							(Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration) : (User.preferences.defaultDuration)) : (User.preferences.defaultDuration)))
+					}, true );
+			
 			    });
 								
@@ -255,4 +268,5 @@
 							
 			};
+			
 		});
 
Index: sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/index.ejs
===================================================================
--- sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/index.ejs	(revision 6797)
+++ sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/index.ejs	(revision 6811)
@@ -87,4 +87,6 @@
 
 <script type='text/javascript' src='<?= MODULESURL ?>/js/map.disponibility.js'></script>
+
+<script type='text/javascript' src='<?= MODULESURL ?>/js/task.helpers.js'></script>
 <script type='text/javascript' src='<?= MODULESURL ?>/js/helpers.js'></script>
 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.shared.js'></script>
Index: sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/task_add.ejs
===================================================================
--- sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/task_add.ejs	(revision 6811)
+++ sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/task_add.ejs	(revision 6811)
@@ -0,0 +1,279 @@
+<div title="Criar Tarefa" class="div-addtask content">
+    <form method="POST" action="<%=(data.event.acl.organization || data.event.acl.write) ?  "schedulable:detail" : "schedulable:preview"%>" class="form-addevent content">
+
+	<fieldset id="calendar_addtask_details1">
+		<legend class="hidden">Detalhes da tarefa</legend>
+		<p class="input-group">
+			<input type="text" class="h1" name="summary" <%=(data.event.acl.organization || data.event.acl.write) ? '' : 'disabled="disabled"' %> value="<%= (data.event.summary) ? data.event.summary : '' %>"/>
+			<% if( data.event.id ){ %>
+				<input type="hidden" class="id-event" name="idEvent" value="<%= data.event.id %>"/>
+			<% } %>
+                        <% if( data.event.id && data.event.calendar ){ %>
+				<input type="hidden" class="last-calendar" name="lastCalendar" value="<%= data.event.calendar %>"/>
+			<% } %>
+		</p>
+		<p class="input-group date-info">
+			<input type="text" class="date start-date" value="<%= (data.event.startDate) ? data.event.startDate : '' %>" <%=(data.event.acl.organization || data.event.acl.write) ? '' : 'disabled="disabled"' %> name="startDate" />
+			<input type="text" class="time start-time<%= (data.event.allDay) ? ' hidden' : '' %>" value="<%= (data.event.startHour) ? data.event.startHour : '' %>" <%= (data.event.acl.organization || data.event.acl.write) ? '' : 'disabled="disabled"' %> name="startHour" /> 
+			<span>até</span>
+			<input type="text" class="date end-date" value="<%= (data.event.endDate) ? data.event.endDate : '' %>" <%= (data.event.acl.organization || data.event.acl.write) ? '' : 'disabled="disabled"' %> name="endDate" />
+			<input type="text" class="time end-time<%= (data.event.allDay) ? ' hidden' : '' %>" value="<%= (data.event.endHour) ? data.event.endHour : '' %>" <%=(data.event.acl.organization || data.event.acl.write) ? '' : 'disabled="disabled"' %> name="endHour" />
+
+				<span class="previsao-termino">Previsão término:</span>
+				<input type="text" class="date date-previsao">
+				<input type="text" class="time time-previsao">
+
+				<a href="#" class="calendar_addevent_details_lnk_timezone <%=((!data.event.acl.organization || !data.event.acl.write) && (data.event.id)) ? "hidden" : '' %>">Fuso horário</a>
+			
+			
+<!--			<input type="text" name="timezone" style="display: none;" />-->
+			<select name="timezone" class="hidden calendar-addtask-details-txt-timezone">
+				<option value="">- None selected -</option>
+				<% for( var tzId in data.event.timezones ){ %>
+				  <option value="<%= tzId %>" <%= data.timezone === tzId ? 'selected="selected"' : '' %>><%= tzId + ' (' + data.event.timezones[ tzId ] + ')' %></option>
+				<% } %>
+			</select>
+			
+			<a class="button suggestion-hours small <%=(data.event.acl.organization || data.event.acl.write || !data.event.isAttendee) ? "hidden" : '' %>" href="#">Sugerir horário</a>
+			
+		</p>
+				
+		<div class="ui-widget messages-validation hidden">
+			<div style="padding: 0.2em 0.7em;" class="ui-state-error ui-corner-all"> 
+				<p class="message">
+					<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"></span> 
+					<label></label>
+				</p>
+			</div>
+		</div>
+		
+		<p class="input-group task-type">
+			<input type="checkbox" name="allDay" value="true" <%= (data.event.acl.organization || data.event.acl.write) ? '' : 'disabled="disabled"' %> <%= (data.event.allDay) ? 'checked="checked"' : '' %>/>
+			<label for="allDay">Dia inteiro</label>
+<!--
+			<input type="checkbox" class="button-repeat" />
+			<label for="calendar_addevent_details_chk_repeat">Repetir</label>-->
+		</p>
+		<div class="subitem">
+				% Conclusão: <input type="number" class="done" value="1"> 
+				<span class="span_done"><input type="checkbox" class="button-repeat" /> Completo<span>
+				<select style="margin: 0 0 0 20px;">
+					<option>Desenvolvimento</option>
+				</select>
+				<span style="margin:0 0 0 20px;">Prioridade<span> 
+				<select>
+					<option>Alta</option>
+					<option selected="selected">Média</option>
+					<option>Baixa</option>
+				</select>
+		</div>
+	</fieldset>
+	<ul style="width: 752px">
+		<li><a href="#calendar_addtask_details2">Detalhes da tarefa</a></li>
+		<li><a href="#calendar_addtask_details4">Lembretes</a></li>
+		<li><a href="#calendar_addtask_details5">Anexos</a></li>
+		<li><a href="#calendar_addtask_details6">Participantes</a></li>
+		<li><a href="#calendar_addtask_details7">Disponibilidade</a></li>
+		<li><a href="#calendar_addtask_details8">Histórico de alterações</a></li>
+	</ul>
+	<fieldset id="calendar_addtask_details2" class="tab-level2">
+		<legend class="hidden">Detalhes do evento</legend>
+
+		<p class="input-group">
+			<label for="calendar_addtask_details_txtarea_description" class="for-textarea" >Descrição</label>
+			<textarea name="description" <%= (data.event.acl.organization || data.event.acl.write) ? '' : 'disabled="disabled"' %> ><%=(data.event) ? data.event.description : '' %></textarea>
+		</p>
+
+		<p class="input-group">
+			<label for="calendar_addtask_details_slt_cal">Grupo</label>
+				<select>
+					<% 
+					  for (var i=0; i< data.event.calendars.length; i++) {
+					  console.log(data);
+					    if(data.event.calendars[i].id != data.event.calendar && Calendar.signatureOf[data.event.calendars[i].id].isOwner != '1' && (!Calendar.signatureOf[data.event.calendars[i].id].permission.acl.write) )
+						continue;
+					%>
+					      <option value="<%= data.event.calendars[i].id %>" <%= data.event.calendars[i].id == data.event.calendar ? 'selected="selected"':'' %>>
+					      <%= data.event.calendars[i].name %>
+					      </option>
+					<% } %>
+				</select>
+			<!--<select name="calendar" >
+			<% 
+			  for (var i=0; i< data.event.calendars.length; i++) {
+			    if(data.event.calendars[i].id != data.event.calendar && Calendar.signatureOf[data.event.calendars[i].id].isOwner != '1' && !Calendar.signatureOf[data.event.calendars[i].id].permission.acl.write)
+				continue;
+			%>
+			      <option value="<%= data.event.calendars[i].id %>" <%= data.event.calendars[i].id == data.event.calendar ? 'selected="selected"':'' %>>
+			      <%= data.event.calendars[i].name %>
+			      </option>
+			<% } %>
+			</select>
+		-->
+		</p>
+		
+		<fieldset class="hidden">
+			<legend class="hidden">Publicidade</legend>
+			<!--
+			<p class="input-group">
+				<label class="input-group">Mostrar-me como</label>
+				<input type="radio" checked="checked"/>
+				<label for="calendar_addevent_details_rdo_status1">Dispon?vel</label>
+				<input type="radio"/>
+				<label for="calendar_addevent_details_rdo_status2">Ocupado</label>
+			</p>
+			-->
+			<p class="input-group">
+				<label class="input-group">Privacidade</label>
+				<input type="radio" name="class" value="1" checked="checked"/>
+				<label for="calendar_addtask_details_rdo_class1">Padrão</label>
+				<input type="radio" name="class" value="2" />
+				<label for="calendar_addtask_details_rdo_class2">Público</label>
+				<input type="radio" name="class" value="3" />
+				<label for="calendar_addtask_details_rdo_class3">Privado</label>
+			</p>
+			
+		</fieldset>
+		
+	</fieldset>
+	
+	<div class="overflow_add_calender">
+	<fieldset id="calendar_addtask_details4" class="tab-level2">
+		<legend class="hidden">Lembretes</legend>
+		
+		<p class="default-alarm-event <%= (!data.event.id && data.event.alarms) ? '' : 'hidden'%>">
+			<input type="checkbox" name="defaultAlarm" value="true" checked="checked"/>
+			<label class="input-default-alarm" for="defautAlarm">Usar alarmes padrões</label>
+		</p>
+	
+		<ul class="task-alarms-list">
+			<% if (data.event && data.event.alarms) {
+				for (var i=0; i< data.event.alarms.length; i++) {
+			%>
+			<li class="input-group">
+				<label>Avisar-me por </label>
+				<select name="alarmType[]">
+                                    <option value="alert" <%= data.event.alarms[i].type=='alert' ? 'selected="selected"':'' %>>Alerta</option>
+                                    <option value="mail" <%= data.event.alarms[i].type=='mail' ? 'selected="selected"':'' %>>E-mail</option>
+                                    <!--<option value="sms" <%= data.event.alarms[i].type=='sms' ? 'selected="selected"':'' %>>SMS</option>-->
+				</select>
+				<input type="text" name="alarmTime[]" class="number input-small" value="<%= data.event.alarms[i].time %>"/>
+				<select name="alarmUnit[]">
+					<option value="m" <%= data.event.alarms[i].unit=='m' ? 'selected="selected"':'' %>>Minutos</option>
+					<option value="h" <%= data.event.alarms[i].unit=='h' ? 'selected="selected"':'' %>>Horas</option>
+					<option value="d" <%= data.event.alarms[i].unit=='d' ? 'selected="selected"':'' %>>Dias</option>
+				</select>
+				<input type="hidden" name="alarmId[]" value="<%=data.event.useAlarmDefault ? '' : data.event.alarms[i].id%>" />
+				<input type="hidden" name="isDefaultAlarm[]" value="<%=data.event.useAlarmDefault ? 1 : 0%>" />
+				<label> antes de cada evento.</label>
+				<a class="button remove tiny"></a>
+			</li>
+			<%	}
+			   }
+			%>
+		</ul>
+		<span class="button add button-add-alarms">Adicionar lembrete</span>
+	
+	</fieldset>
+	</div>
+	
+	<fieldset id="calendar_addtask_details6" class="tab-level2" title="Participantes">
+	</fieldset>	
+	
+	<fieldset id="calendar_addtask_details7" class="tab-level2" title="Disponibilidade">
+	</fieldset>
+	
+	<fieldset id="calendar_addtask_details8" class="tab-level2" title="Histórico de alterações">
+		<div class="parent"  >
+			
+			<div class="child-top">
+				<div class="date-hour"><span>Data -Hora</span></div>
+				<div class="organization"><span>Participante/Organizador</span></div>
+			</div>
+
+			<div class="child-bottom">
+				<% for(var i=0; i<15; i++){ %>
+					<div class="child-bottom-each">
+						<div class="date-hour"><span>17/05 - 23:43</span></div>
+						<div class="organization"><span>thiago da silva sauro</span></div>
+					</div>
+				<% } %>
+			</div>
+
+		</div>
+	</fieldset>
+
+	<fieldset class="attachment-list hidden">
+             <%if(data.event && data.event.attachments){
+                for (var i=0; i< data.event.attachments.length; i++) {%>
+                    <input type="hidden" name="fileId[]" value="<%=data.event.attachments[i].id%>"/>
+                <%}
+            }%>
+	</fieldset>
+    </form>
+    
+<div class="overflow_add_calender">
+	<fieldset id="calendar_addtask_details5" class="tab-level2">
+        <form id="fileupload" action="attachment:detail" method="POST">
+        <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
+        <div class="row fileupload-buttonbar-task">
+            <div class="button-files-upload">
+                <!-- The fileinput-button span is used to style the file input field as button -->
+                <%if(data.event.acl.organization || data.event.acl.write){%>
+		    <span class="button btn-success fileinput-button">
+                    <span><i class="icon-plus icon-white"></i> Adicionar</span>
+                    <input type="file" name="files[]" multiple>
+                </span>
+				<%}%>
+				<%if(data.event.acl.organization || data.event.acl.write){%>
+					<button type="button" class="button btn-danger delete">
+						<i class="icon-trash icon-white"></i> Remover Todos
+					</button>
+				<%}%>
+            </div>
+            <div id="fileupload-progress"></div>
+            <div class="files-list">
+               <ul class="attachments-list">
+			   <%if(data.event && data.event.attachments){
+					for (var i=0; i< data.event.attachments.length; i++) {
+					%>
+						<p class="input-group arquive-info">
+							<label class="lbl-archive-nome">Nome:</label>
+							<span class="archive-nome"><%=data.event.attachments[i].name%></span>
+							
+							<label class="lbl-archive-size">Tamanho:</label>
+							<span class="archive-size"><%=data.event.attachments[i].size%></span>
+							<a href="../prototype/getArchive.php?attachment=<%=data.event.attachments[i].id%>" class="button tiny upload downlaod-archive">Download</a>
+							<%if(data.event.acl.organization || data.event.acl.write){%>
+								<span class="button close tiny upload edit delete-upload" title="Deletar">Deletar</span>
+							<%}%>
+							<input type="hidden" name="fileId[]" value="<%=data.event.attachments[i].id%>"/>
+						</p>
+					<%}
+				}%>
+			   
+			   
+			   </ul>
+            </div>
+        </div>
+        <br>
+        
+    </form>
+	</fieldset>
+</div>
+	<form action="../prototype/modules/calendar/export.php" method="GET" class="form-export content">
+		<input type="hidden" class="id-task" name="task" value="<%= data.event.id %>"/>
+	</form>
+<!--	<div id="calendar_addevent_addattendee"></div>-->
+
+    <div title="" class="menu-container footer-container menu-addtask">
+	    <% if (data.event.id) { %>
+			<a title="Exportar" class="button export" href="#">Exportar</a>
+			<a title="Excluir" class="button delete" href="#">Excluir</a>
+	    <% } %>
+		<a title="Cancelar" class="button cancel" href="#">Cancelar</a>
+	    <a title="Salvar" class="button save" href="#">Salvar</a>
+    </div>
+</div>
+<!--<script src="application.js"></script>-->
+<!--<script src="application.js"></script>-->
