Index: /branches/2.4/index.php
===================================================================
--- /branches/2.4/index.php (revision 6116)
+++ /branches/2.4/index.php (revision 7158)
@@ -145,6 +145,19 @@
$modulo = explode('.', $_GET['menuaction']);
- if($modulo[0] == 'expressoAdmin1_2')
- echo '';
+ if($modulo[0] == 'expressoAdmin1_2' || $modulo[0] == 'calendar'){
+ echo '
+
+
+
+
+
+
+
+
+
+
+
+ ';
+ }
}
?>
Index: /branches/2.4/calendar/templates/default/listContacts.ejs
===================================================================
--- /branches/2.4/calendar/templates/default/listContacts.ejs (revision 7158)
+++ /branches/2.4/calendar/templates/default/listContacts.ejs (revision 7158)
@@ -0,0 +1,46 @@
+<%
+ var decodeType = {
+ '/dynamiccontacts': {
+ css: 'recent',
+ img: 'recent',
+ text: 'Contato dinâmico'
+ },
+ '/contacts':{
+ css: 'personal',
+ img: 'personal',
+ text: 'Contato pessoal',
+ },
+ '/sharedcontact':{
+ css: 'personal',
+ img: 'sharedcontact',
+ text: 'Contato compartilhado',
+ },
+ '/groups':{
+ css: 'group',
+ img: 'group',
+ text: 'Grupo pessoal',
+ },
+ '/sharedgroup':{
+ css: 'group',
+ img: 'sharedgroup',
+ text: 'Grupo compartilhado',
+ }
+ }
+%>
+<%if (data.type == 'linha'){%>
+
+
+
+
+<%}else{%>
+
+
+
+ <%= ($.trim(data.name) != "" ? (data.name.length > 20? data.name.substring(0,17)+"..." : data.name)+ " - " : "") %><%= data.mail %>
+ <% if(data.type == '/dynamiccontacts'){ %>
+
+ <% } %>
+
+ Excluir contato recente
+<%}%>
+
Index: /branches/2.4/calendar/templates/default/js/edit_exmail.js
===================================================================
--- /branches/2.4/calendar/templates/default/js/edit_exmail.js (revision 5143)
+++ /branches/2.4/calendar/templates/default/js/edit_exmail.js (revision 7158)
@@ -318,25 +318,231 @@
}
+function controlInputBinds(){
+ var div = $('#tbl_ext_participants').find('textarea');
+ div.bind('keydown',function(e){
+ //SELECIONA O CONTATO E EVITA OUTROS COMANDOS
+ if ( e.keyCode === $.ui.keyCode.TAB && $( this ).data( "catcomplete" ).menu.active ) {
+ e.preventDefault();
+ return false;
+ }
+
+ //FECHA OS CONTATOS DINÂMICOS
+ if( (e.keyCode == 27) && $( this ).data( "catcomplete" ).menu.active ){
+ e.stopPropagation();
+ e.preventDefault();
+ }
+
+ //SELECIONA O CONTATO E EVITA OUTROS COMANDOS
+ if(e.keyCode == $.ui.keyCode.ENTER && $( this ).data( "catcomplete" ).menu.active){
+ e.preventDefault();
+ return false;
+ }
+ //BUSCA COM A TECLA F9
+ if((e.keyCode) == 120){
+
+ e.preventDefault();
+ return false;
+ }
+ });
+}
+
+var cache = new Array();
+var dynamicPersonalContacts = new Array();
+var dynamicContacts = new Array();
+var topContact = 0;
+
+function split( val ) {
+ return val.split( /,\s*/ );
+}
+
+function extractLast( term ) {
+ return split( term ).pop();
+}
+
+function updateDynamicContact(){
+ dynamicContacts = new Array();
+ var dynamicData = REST.get("/dynamiccontacts").collection.itens;
+ if(dynamicData){
+ $.each(dynamicData, function(index, value){
+ if(index ==0){
+ topContact = parseInt(value.data[2].value);
+ }
+ var dynamic = {
+ name : value.data[0].value,
+ mail : value.data[1].value,
+ value: value.data[0].value + " - " + value.data[1].value,
+ type: "",
+ id: parseInt(value.data[3].value),
+ qtd : parseInt(value.data[2].value)
+ };
+ dynamicContacts.push(dynamic);
+ });
+ }
+}
+
+
+function updateDynamicPersonalContacts(){
+ dynamicPersonalContacts = new Array();
+ var contactsData = REST.get("/contacts").collection.itens;
+ if(contactsData){
+ $.each(contactsData, function(index, value){
+ var contact = {
+ id : parseInt(value.data[0].value),
+ name : value.data[1].value,
+ email : value.data[2].value,
+ value: value.data[1].value + " - " + value.data[2].value,
+ type: "P"
+ };
+ dynamicPersonalContacts.push(contact);
+ });
+ }
+}
+
+/*Adiciona um novo contato selecionado*/
+function update_mailField(email){
+ var mailList = $('#tbl_ext_participants').find('textarea');
+ var newList = "";
+ if (mailList.val().indexOf(email) != -1){
+ $.Zebra_Dialog('O email '+ email +' já consta na lista!');
+ }
+ if (mailList.val().indexOf(',') > 0){
+ var ctcList = mailList.val().split(',');
+ for(var ii=0; ii 1) {
- for(j = 1; typeof(arguments[j]) != 'undefined'; j++)
- value = value.replace("%"+j,arguments[j]);
- }
- return value;
- };
- loadScript(path+"/js/DropDownContacts.js");
- loadScript(path+"/js/QuickCatalogSearch.js");
- loadScript("calendar/templates/default/js/over_fn_exmail.js");
- if(!contacts)
- cExecute (path+'.db_functions.get_dropdown_contacts', save_contacts);
-}
+ $.widget( "custom.catcomplete", $.ui.autocomplete, {
+ _renderMenu: function( ul, items ) {
+ var self = this,
+ currentType = "";
+ $.each( items, function( index, item ) {
+ if ( item.typel != currentType) {
+ if(item.typel == "/groups" && $(ul).find(".dynamic-recent").length)
+ self._renderItem( ul, {name:"", value:"", type:"linha"} );
+ if(item.typel == "/contacts" && ($(ul).find(".dynamic-group").length || $(ul).find(".dynamic-recent").length))
+ self._renderItem( ul, {name:"", value:"", type:"linha"} );
+ currentType = item.typel;
+ }
+ self._renderItem( ul, item );
+ $(ul).find("li:last").find(".dynamic-stars").raty({
+ readOnly : true,
+ half : true,
+ hints : ['','','','',''],
+ score : ((item.number_of_messages*5)/topContact) > 0.5 ? ((item.number_of_messages*5)/topContact) : 0.5,
+ starOn : '../prototype/plugins/jq-raty/img/star-on.png',
+ starOff : '../prototype/plugins/jq-raty/img/star-off.png',
+ starHalf : '../prototype/plugins/jq-raty/img/star-half.png'
+ });
+ });
+
+ if($(ul).find("li:last").hasClass("dynamic-separator")){
+ $(ul).find("li:last").remove();
+ }
+ $(ul).scroll(function(){
+ canMakeBox = false;
+ });
+ }
+ });
+ $('#tbl_ext_participants').find('textarea').catcomplete({
+ minLength: 1,
+ source: function(request, response){
+ request.term = extractLast( request.term );
+ if ( request.term in cache ) {
+ response( cache[ request.term ] );
+ return;
+ }
+ dynamicContactsList = new Array();
+ REST.get("/usercontacts", false, function(data){
+ dynamicData = data.collection.itens;
+ if(dynamicData){
+ $.each(dynamicData, function(index, value){
+ dynamic = {};
+ $.each(value.data, function(index, value){
+ dynamic[value.name] = value.value;
+ });
+ dynamic['value'] = (dynamic.name ? dynamic.name +' - ': '') + dynamic.mail;
+ dynamic['type'] = value.dataType;
+ dynamic['typel'] = (value.dataType.substring(0,7) == "/shared" ? "/"+value.dataType.substring(7,value.dataType.length)+"s" : value.dataType) ;
+ dynamicContactsList.push(dynamic);
+ });
+ }
+ var data = $.ui.autocomplete.filter(dynamicContactsList, request.term );
+ cache[ request.term ] = data;
+ response( data );
+ });
+ },
+ focus: function() {
+ return false;
+ },
+
+ //EVENTO AO SELECIONAR UM CONTATO DINÂMICO
+ select: function( event, ui ) {
+ event.preventDefault();
+ update_mailField(ui.item.mail);
+ },
+ position : { my: "left top", at: "left bottom", collision: "fit" }
+ }).bind('catcompleteopen', function(event, ui) {
+ $(this).data('is_open',true);
+ }).bind('catcompleteclose', function(event, ui) {
+ $(this).data('is_open',false);
+ })
+
+ //MONTAGEM DA LISTA DE CONTATOS DINÂMICOS DO AUTO COMPLETE
+ .data( "catcomplete" )._renderItem = function( ul, item ) {
+ if($(ul).find("li").length < 50){
+ var autocomplete = $(this)[0].element;
+ //cálculo dinâmico da largura da lista
+ var width = (item.label ? item.label.length : (item.value ? item.value.length : (item.email ? item.email.length : 20 )));
+ width = width*5 + (is_ie ? 170 : 200) + 16;
+ if (width < $(ul).width())
+ width = $(ul).width();
+ ul.css({"min-width":width,"max-width":$('#tbl_ext_participants').find('textarea').width(),"max-height" : "180px", "overflow-y" : "auto", "min-height": "30px"});
+ var listContacts = DataLayer.render("calendar/templates/default/listContacts.ejs", item);
+ return $(listContacts).data( "item.autocomplete", item ).appendTo( ul ).find("span:last").button({
+ icons : {
+ primary : "ui-icon-close"
+ },
+ text: false
+ }).click(function(event){
+ var removeLi = $(this).parents("li:first");
+ if(!event.keyCode)
+ autocomplete.catcomplete( "close" );
+ canMakeBox = false;
+ $.Zebra_Dialog('Deseja remover '+(item.name ? item.name+" - " : "")+ item.mail+'?', {
+ 'type': 'question',
+ 'custom_class': (is_ie ? 'configure-zebra-dialog' : ''),
+ 'title': 'Atenção',
+ 'buttons': ['Sim','Não'],
+ 'overlay_opacity': '0.5',
+ 'onClose': function(caption) {
+ if(caption == 'Sim'){
+ $(removeLi).remove();
+ REST['delete']("/dynamiccontact/"+item.id);
+ updateDynamicContact();
+ cache = new Array();
+ }else if(caption == 'Não'){
+ $(focusIn).focus();
+ }
+ }
+ });
+ });
+ }
+ return;
+ };
+ }
function hideExParticipants(el,path){