Changeset 285 for trunk/contactcenter/js/ccQuickAddContact.js
- Timestamp:
- 05/23/08 17:10:39 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/contactcenter/js/ccQuickAddContact.js
r284 r285 6 6 } 7 7 8 8 9 9 cQuickAddContact.prototype.showList = function(id){ 10 10 _this = this; 11 11 var handler = function (responseText) { 12 12 var contacts = unserialize(responseText); 13 var title = contacts['names_ordered']; 14 el = document.createElement("DIV"); 15 el.style.visibility = "hidden"; 13 var title = contacts['names_ordered']; 14 el = document.createElement("DIV"); 15 el.style.visibility = "hidden"; 16 16 el.style.position = "absolute"; 17 17 el.style.left = "0px"; … … 21 21 el.style.height = wHeight + 'px'; 22 22 el.className = "div_cc_rectQuickAddContact"; 23 el.id = id+':cc_rectQuickAddContact'; 24 document.body.appendChild(el); 25 el.innerHTML = ""; 23 el.id = id+':cc_rectQuickAddContact'; 24 document.body.appendChild(el); 25 el.innerHTML = ""; 26 26 27 27 var fieldsTop = 10; 28 28 var fieldsSpace = 30; 29 29 fields = new Array(Element('cc_qa_alias').value, Element('cc_qa_given_names').value, Element('cc_qa_family_names').value, Element('cc_qa_phone').value, Element('cc_qa_email').value); 30 30 31 31 for (i=0; i<fields.length; i++) { 32 32 var contact = contacts[i] != null ? contacts[i] : ''; … … 43 43 { 44 44 el.innerHTML += '<input id="ccQuickAddCI' + i + id + '" type="text" value="' + contact + '" maxlength="50" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 110px; width: 135px;">'; 45 } 45 } 46 46 } 47 47 48 48 el.innerHTML +='<div id="ccQAFuncitons" style="border: 0px solid black; width: 220px; height: 20px">' + 49 '<input title=" ccQASave"type="button" onclick="ccQuickAddContact.send(\'' + id + '\');" value="' + Element('cc_qa_save').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 75px; width: 60px" />' +50 '<input title=" ccQAClear" type="button" onclick="ccQuickAddContact.fechar(\'' + id + '\');" value="' + Element('cc_qa_clear').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 140px; width: 60px" />' +49 '<input title="' + Element('cc_qa_save').value + '" type="button" onclick="ccQuickAddContact.send(\'' + id + '\');" value="' + Element('cc_qa_save').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 75px; width: 60px" />' + 50 '<input title="' + Element('cc_qa_close').value + '" type="button" onclick="ccQuickAddContact.fechar(\'' + id + '\');" value="' + Element('cc_qa_close').value + '" style="position: absolute; top: ' + (fieldsTop+i*fieldsSpace) + 'px; left: 140px; width: 60px" />' + 51 51 '</div>'; 52 52 el.innerHTML += "<br>"; 53 53 54 54 _this.showWindow(el); 55 55 } 56 56 57 57 div = document.getElementById(id+':cc_rectQuickAddContact'); 58 58 59 59 if(div) 60 60 this.showWindow(div); … … 63 63 } 64 64 } 65 65 66 66 cQuickAddContact.prototype.showWindow = function (div) 67 { 67 { 68 68 if(! this.arrayWin[div.id]) { 69 69 70 win = new dJSWin({ 70 win = new dJSWin({ 71 71 id: 'ccQuickAddContact_'+div.id, 72 72 content_id: div.id, … … 75 75 title_color: '#3978d6', 76 76 bg_color: '#eee', 77 title: Element('ccQATitle').value, 77 title: Element('ccQATitle').value, 78 78 title_text_color: 'white', 79 79 button_x_img: Element('cc_phpgw_img_dir').value+'/winclose.gif', 80 80 border: true }); 81 81 82 82 this.arrayWin[div.id] = win; 83 win.draw(); 83 win.draw(); 84 84 } 85 85 else { 86 86 win = this.arrayWin[div.id]; 87 } 87 } 88 88 win.open(); 89 89 } 90 90 91 91 cQuickAddContact.prototype.send = function (id) 92 92 { … … 115 115 return; 116 116 } 117 117 118 118 win.close(); 119 119 … … 132 132 } 133 133 } 134 134 135 135 var sdata = new Array(); 136 136 137 137 for (var f = 0; f < 5; f++){ 138 138 sdata[f] = document.getElementById('ccQuickAddCI' + f + id).value; 139 139 } 140 140 141 141 //Utiliza expressão regular para validar email 142 142 var reEmail = /^[A-Za-z\d_-]+(\.[A-Za-z\d_-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/; … … 147 147 return false; 148 148 } 149 149 150 150 //Utiliza expressão regular para validar telefone 151 151 var rePhone = /^[0-9|(-)| |-]{0,15}$/; 152 152 153 153 if (!rePhone.test(sdata[3])){ 154 154 alert("O número de telefone '" + sdata[3] + "' não é valido! Utilize apenas números.\n" + 155 155 "Parenteses, traços ou espaços em branco podem ser usados como carácter separador."); 156 156 return false; 157 } 158 157 } 158 159 159 var sdata = 'add='+escape(serialize(sdata)); 160 160 161 161 Connector.newRequest('cQuickAdd.Send', CC_url+'quick_add', 'POST', handler, sdata); 162 162 } 163 163 164 164 cQuickAddContact.prototype.fechar = function(id) { 165 165 166 166 div = document.getElementById(id+':cc_rectQuickAddContact'); 167 167 win = this.arrayWin[div.id]; 168 168 win.close(); 169 169 } 170 171 170 171 172 172 /* Build the Object */ 173 173 var ccQuickAddContact ; … … 175 175 176 176 if (is_ie) 177 { 178 document.body.onload = function (e) 179 { 177 { 178 document.body.onload = function (e) 179 { 180 180 cQuickAddContact_pre_load(); 181 181 ccQuickAddContact = new cQuickAddContact(); 182 182 183 183 }; 184 184 }
Note: See TracChangeset
for help on using the changeset viewer.