[2] | 1 | var BordersArray = new Array(); |
---|
| 2 | BordersArray[0] = new setBorderAttributes(0); |
---|
| 3 | |
---|
| 4 | function setBorderAttributes(ID) |
---|
| 5 | { |
---|
| 6 | this.border_id = "border_id_"+ID; |
---|
| 7 | this.sequence = ID; |
---|
| 8 | } |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | function alternate_border(ID) |
---|
| 12 | { |
---|
| 13 | var len = BordersArray.length; |
---|
| 14 | for (var i=0; i < len; i++) |
---|
| 15 | { |
---|
| 16 | m = document.getElementById(BordersArray[i].border_id); |
---|
| 17 | if (m.className == 'menu-sel') |
---|
| 18 | { |
---|
| 19 | m.className = 'menu'; |
---|
| 20 | c = document.getElementById("content_id_"+BordersArray[i].sequence); |
---|
| 21 | c.style.display = 'none'; |
---|
| 22 | if(Element("font_border_id_"+BordersArray[i].sequence)) |
---|
| 23 | Element("font_border_id_"+BordersArray[i].sequence).className = 'font-menu'; |
---|
| 24 | var body = Element('body_'+BordersArray[i].sequence); |
---|
| 25 | if (body) |
---|
| 26 | { |
---|
| 27 | try |
---|
| 28 | { |
---|
| 29 | if (Element('viewsource_rt_checkbox').checked) |
---|
| 30 | { |
---|
| 31 | connector.loadScript("rich_text_editor"); |
---|
| 32 | RichTextEditor.viewsource(false); |
---|
| 33 | } |
---|
| 34 | } |
---|
| 35 | catch(e) |
---|
| 36 | { |
---|
| 37 | //alert(e.message) |
---|
| 38 | } |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | m = Element("border_id_"+ID); |
---|
| 44 | m.className = 'menu-sel'; |
---|
| 45 | if(Element("font_border_id_" + ID)) |
---|
| 46 | Element("font_border_id_" + ID).className = 'font-menu-sel'; |
---|
| 47 | var c = Element("content_id_"+ID) |
---|
| 48 | c.style.display = ''; |
---|
| 49 | |
---|
| 50 | body = document.getElementById('body_'+ ID); |
---|
| 51 | if (body){ |
---|
| 52 | try{ |
---|
| 53 | if(ID){ |
---|
| 54 | connector.loadScript("rich_text_editor"); |
---|
| 55 | RichTextEditor.loadEditor(ID); |
---|
| 56 | } |
---|
| 57 | body.contentWindow.document.designMode="on"; |
---|
| 58 | } |
---|
| 59 | catch(e){ |
---|
| 60 | //alert(e.message); |
---|
| 61 | } |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | // hide the DropDrowContact, if necessary |
---|
| 65 | window_DropDownContacts = Element('tipDiv'); |
---|
| 66 | if ((window_DropDownContacts)&&(window_DropDownContacts.style.visibility != 'hidden')){ |
---|
| 67 | window_DropDownContacts.style.visibility = 'hidden'; |
---|
| 68 | } |
---|
[58] | 69 | Element("footer_menu").style.display = ID ? 'none' : ''; |
---|
[156] | 70 | |
---|
| 71 | var span_options = document.getElementById("span_options"); |
---|
| 72 | if ((span_options) && (ID == 0)){ |
---|
| 73 | var span_D = Element("span_D"); |
---|
| 74 | span_options.innerHTML = |
---|
| 75 | '<span title="'+get_lang("Delete")+'" style="margin-left:8px;" class="message_options" onclick=delete_msgs(\'null\',\'selected\',\'null\')>'+get_lang("Delete")+'</span> | '+ |
---|
| 76 | '<span title="'+get_lang("Move")+'" class="message_options" onclick=wfolders.makeWindow(\"\",\"move_to\")>'+get_lang("Move")+'</span> | '+ |
---|
| 77 | '<span title="'+get_lang("Print")+'" class="message_options" onclick=print_all()>'+get_lang("Print")+'</span> | '+ |
---|
| 78 | '<span title="'+get_lang("Export")+'" class="message_options" onclick="export_all_selected_msgs()">'+get_lang("Export")+'</span>'; |
---|
| 79 | span_options.setAttribute('style',"font-size:5px;"); |
---|
| 80 | span_D.parentNode.insertBefore(span_options,span_D); |
---|
| 81 | } else |
---|
| 82 | if ((span_options) && (ID != 0)){ |
---|
| 83 | span_options.innerHTML = '<span title="'+get_lang("Delete")+'" style="margin-left:8px" class="message_options" onclick=delete_search_msgs(content_id_'+ID+')>'+get_lang("Delete")+'</span>'; |
---|
| 84 | } |
---|
| 85 | |
---|
[2] | 86 | return ID; |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | function create_border(borderTitle, id_value) |
---|
| 90 | { |
---|
| 91 | var resize = false; |
---|
| 92 | var offWidth = Element('border_blank').offsetWidth ? Element('border_blank').offsetWidth : Element('border_blank').clientWidth; |
---|
| 93 | if (offWidth < 200) { |
---|
| 94 | resize = resize_borders(); |
---|
| 95 | if (!resize){ |
---|
| 96 | alert('Limite máximo de abas atingido!'); |
---|
| 97 | return false; |
---|
| 98 | } |
---|
| 99 | } |
---|
[58] | 100 | Element("footer_menu").style.display = 'none'; |
---|
[2] | 101 | var ID = id_value ? id_value : parseInt(BordersArray[(BordersArray.length-1)].sequence) + 1; |
---|
| 102 | |
---|
| 103 | td = document.createElement("TD"); |
---|
| 104 | td.id="border_id_" + ID; |
---|
| 105 | if(resize) { |
---|
| 106 | td.setAttribute("width", parseInt(resize)+"px"); |
---|
| 107 | td.style.width = parseInt(resize)+"px"; |
---|
| 108 | } |
---|
| 109 | else |
---|
| 110 | td.setAttribute("width", "200px"); |
---|
| 111 | |
---|
| 112 | td.className = "menu"; |
---|
| 113 | td.setAttribute("align", "right"); |
---|
| 114 | td.onclick = function(){alternate_border(ID);}; |
---|
| 115 | td.setAttribute("noWrap","true"); |
---|
| 116 | var subject = borderTitle; |
---|
| 117 | |
---|
| 118 | borderTitle = borderTitle ? borderTitle : id_value ? get_lang("No Subject") : " " ; |
---|
| 119 | td.value = borderTitle; |
---|
| 120 | if (borderTitle.length > 21){ |
---|
| 121 | borderTitle = borderTitle.substring(0,21) + "..."; |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | if (resize) |
---|
| 125 | borderTitle = borderTitle.substring(0, resize*0.08); |
---|
| 126 | |
---|
| 127 | td.innerHTML = "<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td id=font_border_id_" + ID+" class='font-menu' width=*>" + borderTitle + "</td><td width=1px><img onmousedown='javascript:return false' style='cursor:pointer' onclick=delete_border('" + ID + "','false') src='templates/default/images/close_button.gif'></td></tr></table>"; |
---|
| 128 | |
---|
| 129 | bb = document.getElementById("border_blank"); |
---|
| 130 | parent_bb = bb.parentNode; //Pego o tbody |
---|
| 131 | parent_bb.insertBefore(td, bb); |
---|
| 132 | |
---|
[72] | 133 | if(id_value && id_value.match(/_r$/)) |
---|
[2] | 134 | _dragArea.makeDragged(td, id_value,td.value); |
---|
| 135 | |
---|
| 136 | BordersArray[BordersArray.length] = new setBorderAttributes(ID); |
---|
| 137 | |
---|
| 138 | var div = document.createElement("DIV"); |
---|
| 139 | div.id = "content_id_" + ID; |
---|
| 140 | div.className = "conteudo"; |
---|
| 141 | div.style.display=''; |
---|
| 142 | |
---|
| 143 | var bar = document.getElementById("toolbar"); |
---|
| 144 | var offset = 0; |
---|
| 145 | if(bar.style.visibility != 'hidden') |
---|
| 146 | offset = bar.offsetHeight ? bar.offsetHeight : bar.clientHeight; |
---|
| 147 | |
---|
| 148 | div.style.height = document.body.clientHeight - offset - (is_ie ? 76 : 86); |
---|
| 149 | div.style.overflow = "auto"; |
---|
| 150 | |
---|
| 151 | if(!is_ie) { |
---|
| 152 | var menuHidden = Element("folderscol").style.display == 'none' ? true : false; |
---|
| 153 | var defaultWidth = document.body.clientWidth - 27; |
---|
| 154 | if(!menuHidden) |
---|
| 155 | defaultWidth -= Element("folderscol").offsetWidth; |
---|
| 156 | |
---|
| 157 | div.style.width = defaultWidth; |
---|
| 158 | // div.style.width ="99.3%"; |
---|
| 159 | } |
---|
[112] | 160 | document.getElementById("exmail_main_body").appendChild(div); |
---|
[2] | 161 | alternate_border(ID); |
---|
| 162 | |
---|
| 163 | return ID; |
---|
| 164 | } |
---|
| 165 | |
---|
| 166 | function resize_borders() |
---|
| 167 | { |
---|
| 168 | var children; |
---|
| 169 | var numBorders = 0; |
---|
| 170 | var widthTD = 0; |
---|
| 171 | var newWidthTD = 0; |
---|
| 172 | children = Element('border_tr').childNodes; |
---|
| 173 | for (var i=0; i<children.length; i++) { |
---|
| 174 | if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')) { |
---|
| 175 | numBorders++; |
---|
| 176 | if(!widthTD) |
---|
| 177 | widthTD = children[i].clientWidth; |
---|
| 178 | } |
---|
| 179 | } |
---|
| 180 | if (numBorders > 8) |
---|
| 181 | return false; |
---|
| 182 | |
---|
| 183 | newWidthTD = ((numBorders*widthTD)+(Element("border_blank").clientWidth-20))/(numBorders+1); |
---|
| 184 | for (var i=0; i<children.length; i++) { |
---|
| 185 | if ((children[i].nodeName === 'TD') && (children[i].id!=='border_id_0') && (children[i].id!=='border_blank')){ |
---|
| 186 | children[i].style.width = newWidthTD; |
---|
| 187 | Element("font_"+children[i].id).innerHTML = Element("font_"+children[i].id).innerHTML.substring(0, newWidthTD*0.08); |
---|
| 188 | } |
---|
| 189 | } |
---|
| 190 | return newWidthTD; |
---|
| 191 | } |
---|
| 192 | |
---|
| 193 | function delete_border(ID, msg_sent) |
---|
| 194 | { |
---|
[125] | 195 | if(!ID) |
---|
| 196 | return false; |
---|
[2] | 197 | if (msg_sent == 'false') |
---|
| 198 | { |
---|
| 199 | var body = document.getElementById('body_'+ ID); |
---|
| 200 | if (body) |
---|
| 201 | { |
---|
| 202 | try |
---|
| 203 | { |
---|
| 204 | if (body.contentWindow.document.designMode.toLowerCase() == 'on') |
---|
| 205 | { |
---|
| 206 | var discard_msg = confirm(get_lang("Your message has not been sent. Discard your message?"), ""); |
---|
| 207 | if (!discard_msg) |
---|
| 208 | return; |
---|
| 209 | } |
---|
| 210 | } |
---|
| 211 | catch(e){ |
---|
| 212 | //alert(e.message); |
---|
| 213 | } |
---|
| 214 | } |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | hold_session = false; |
---|
| 218 | for (i=0;i<BordersArray.length;i++) |
---|
| 219 | { |
---|
| 220 | m = document.getElementById(BordersArray[i].border_id); |
---|
| 221 | if (m.className == 'menu-sel') |
---|
| 222 | border_selected = BordersArray[i].border_id; |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | if ('border_id_' + ID == border_selected) |
---|
| 226 | { |
---|
| 227 | if (BordersArray[i-2].sequence == ID) |
---|
| 228 | this.alternate_border(0); |
---|
| 229 | else |
---|
| 230 | this.alternate_border(BordersArray[i-2].sequence); |
---|
| 231 | } |
---|
| 232 | |
---|
| 233 | // Remove TD, title |
---|
| 234 | border = document.getElementById('border_id_' + ID); |
---|
| 235 | border.parentNode.removeChild(border); |
---|
| 236 | // Remove Div Content |
---|
| 237 | content = document.getElementById('content_id_' + ID); |
---|
| 238 | content.parentNode.removeChild(content); |
---|
| 239 | |
---|
| 240 | var new_BordersArray = new Array(); |
---|
| 241 | j = 0; |
---|
| 242 | for (i=0;i<BordersArray.length;i++) |
---|
| 243 | { |
---|
| 244 | if (document.getElementById(BordersArray[i].border_id) != null){ |
---|
| 245 | new_BordersArray[j] = BordersArray[i]; |
---|
| 246 | j++; |
---|
| 247 | } |
---|
| 248 | } |
---|
[58] | 249 | if(j == 1) |
---|
| 250 | Element("footer_menu").style.display = ''; |
---|
[2] | 251 | BordersArray = new_BordersArray; |
---|
| 252 | } |
---|