Index: /trunk/index.php
===================================================================
--- /trunk/index.php (revision 6116)
+++ /trunk/index.php (revision 7147)
@@ -145,6 +145,20 @@
$modulo = explode('.', $_GET['menuaction']);
- if($modulo[0] == 'expressoAdmin1_2')
- echo '';
+ if($modulo[0] == 'expressoAdmin1_2' || $modulo[0] == 'calendar'){
+ echo '
+
+
+
+
+
+
+
+
+
+
+
+ ';
+
}
+ }
?>
Index: /trunk/calendar/templates/default/listContacts.ejs
===================================================================
--- /trunk/calendar/templates/default/listContacts.ejs (revision 7147)
+++ /trunk/calendar/templates/default/listContacts.ejs (revision 7147)
@@ -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: /trunk/calendar/templates/default/js/edit_exmail.js
===================================================================
--- /trunk/calendar/templates/default/js/edit_exmail.js (revision 5143)
+++ /trunk/calendar/templates/default/js/edit_exmail.js (revision 7147)
@@ -18,5 +18,5 @@
}
-// Verifica versão do Firefox
+// Verifica versão do Firefox
var agt = navigator.userAgent.toLowerCase();
var is_firefox_0 = agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.') ? true : false;
@@ -154,5 +154,5 @@
function submitValues(button){
loadScript("expressoMail1_2/js/common_functions.js");
- button.disabled = true; //Desabilita Botão para evitar varios clicks
+ button.disabled = true; //Desabilita Botão para evitar varios clicks
var typeField = document.getElementById('cal[type]');
@@ -177,5 +177,5 @@
if( !isChecked && !document.getElementsByName( "cal[rpt_use_end]" )[0].checked && !(document.getElementsByName( "cal[recur_type]" )[0].value === "0")){
- alert("Agendamentos recorrentes precisam de data final da repetição");
+ alert("Agendamentos recorrentes precisam de data final da repetição");
button.disabled = false;
return false;
@@ -190,5 +190,5 @@
if(document.getElementsByName( "cal[rpt_use_end]" )[0].checked){
if(!validate_date_order(document.getElementById('start[str]').value, document.getElementById('recur_enddate[str]').value)){
- alert("A data final não pode ser menor que a data inicial.");
+ alert("A data final não pode ser menor que a data inicial.");
button.disabled = false;
return false;
@@ -197,5 +197,5 @@
//Valida data inicio nao nula
if(document.getElementById('start[str]').value == ''){
- alert("Necessario preencher a data de início.");
+ alert("Necessario preencher a data de inÃcio.");
document.getElementById('start[str]').focus();
button.disabled = false;
@@ -207,5 +207,5 @@
document.getElementById('start[str]').value = '';
document.getElementById('start[str]').focus();
- alert("A data de início não é válida.");
+ alert("A data de inÃcio não é válida.");
button.disabled = false;
return false;
@@ -217,5 +217,5 @@
document.getElementById('end[str]').value = '';
document.getElementById('end[str]').focus();
- alert("A data de término não é válida.");
+ alert("A data de término não é válida.");
button.disabled = false;
return false;
@@ -227,5 +227,5 @@
document.getElementById('start_hour').value = '';
document.getElementById('start_hour').focus();
- alert("A hora de início deve ser números.");
+ alert("A hora de inÃcio deve ser números.");
button.disabled = false;
return false;
@@ -235,5 +235,5 @@
document.getElementById('start_minute').value = '';
document.getElementById('start_minute').focus();
- alert("A hora de início deve ser números.");
+ alert("A hora de inÃcio deve ser números.");
button.disabled = false;
return false;
@@ -243,5 +243,5 @@
document.getElementById('end_hour').value = '';
document.getElementById('end_hour').focus();
- alert("A hora do término deve ser números.");
+ alert("A hora do término deve ser números.");
button.disabled = false;
return false;
@@ -251,5 +251,5 @@
document.getElementById('end_minute').value = '';
document.getElementById('end_minute').focus();
- alert("A hora do término deve ser números.");
+ alert("A hora do término deve ser números.");
button.disabled = false;
return false;
@@ -265,5 +265,5 @@
document.getElementById('end_minute').value = '';
document.getElementById('start_hour').focus();
- alert("A hora final não pode ser menor que a hora inicial.");
+ alert("A hora final não pode ser menor que a hora inicial.");
button.disabled = false;
return false;
@@ -276,5 +276,5 @@
document.getElementById('end_minute').value = '';
document.getElementById('start_hour').focus();
- alert("A hora final não pode ser menor que a hora inicial.");
+ alert("A hora final não pode ser menor que a hora inicial.");
button.disabled = false;
return false;
@@ -318,25 +318,232 @@
}
+
+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){
@@ -397,10 +604,10 @@
function fixBugInnerSelect(objeto,innerHTML){
/******
-* select_innerHTML - altera o innerHTML de um select independente se é FF ou IE
-* Corrige o problema de não ser possível usar o innerHTML no IE corretamente
+* select_innerHTML - altera o innerHTML de um select independente se é FF ou IE
+* Corrige o problema de não ser possÃvel usar o innerHTML no IE corretamente
* Veja o problema em: http://support.microsoft.com/default.aspx?scid=kb;en-us;276228
-* Use a vontade mas coloque meu nome nos créditos. Dúvidas, me mande um email.
-* Versão: 1.0 - 06/04/2006
-* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br
+* Use a vontade mas coloque meu nome nos créditos. Dúvidas, me mande um email.
+* Versão: 1.0 - 06/04/2006
+* Autor: Micox - Náiron José C. Guimarães - micoxjcg@yahoo.com.br
* Parametros:
* objeto(tipo object): o select a ser alterado
@@ -414,5 +621,5 @@
selTemp = document.getElementById("micoxselect1")
selTemp.style.display="none"
- if(innerHTML.toLowerCase().indexOf("