Changeset 2260 in subversion
- Timestamp:
- Jan 23, 2009 2:31:41 PM (4 years ago)
- Location:
- branches/devel-api/program
- Files:
-
- 4 edited
-
include/rcube_template.php (modified) (1 diff)
-
js/app.js (modified) (39 diffs)
-
js/editor.js (modified) (1 diff)
-
js/list.js (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-api/program/include/rcube_template.php
r2224 r2260 67 67 68 68 // don't wait for page onload. Call init at the bottom of the page (delayed) 69 $javascript_foot = "if (window.call_init)\n call_init('".JS_OBJECT_NAME."');";69 $javascript_foot = '$(document).ready(function(){ '.JS_OBJECT_NAME.'.init(); });'; 70 70 71 71 $this->add_script($javascript, 'head_top'); -
branches/devel-api/program/js/app.js
r2226 r2260 54 54 jQuery.ajaxSetup({ cache:false, 55 55 error:function(request, status, err){ ref.http_error(request, status, err); }, 56 beforeSend:function(xmlhttp){ xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('roundcube_sessid')); } ,56 beforeSend:function(xmlhttp){ xmlhttp.setRequestHeader('X-RoundCube-Referer', bw.get_cookie('roundcube_sessid')); } 57 57 }); 58 58 … … 544 544 var sort_col = a_sort[0]; 545 545 var sort_order = a_sort[1] ? a_sort[1].toUpperCase() : null; 546 var header;547 546 548 547 // no sort order specified: toggle … … 559 558 560 559 // set table header class 561 if (header = document.getElementById('rcm'+this.env.sort_col)) 562 this.set_classname(header, 'sorted'+(this.env.sort_order.toUpperCase()), false); 563 if (header = document.getElementById('rcm'+sort_col)) 564 this.set_classname(header, 'sorted'+sort_order, true); 560 $('#rcm'+this.env.sort_col).removeClass('sorted'+(this.env.sort_order.toUpperCase())); 561 $('#rcm'+sort_col).addClass('sorted'+sort_order); 565 562 566 563 // save new sort properties … … 1159 1156 // handle mouse release when dragging 1160 1157 if (this.drag_active && model && this.env.last_folder_target) { 1161 this.set_classname(this.get_folder_li(this.env.last_folder_target), 'droptarget', false);1158 $(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget'); 1162 1159 this.command('moveto', model[this.env.last_folder_target].id); 1163 1160 this.env.last_folder_target = null; … … 1203 1200 if (mouse.x < pos.x1 || mouse.x >= pos.x2 || mouse.y < pos.y1 || mouse.y >= pos.y2) { 1204 1201 if (this.env.last_folder_target) { 1205 this.set_classname(this.get_folder_li(this.env.last_folder_target), 'droptarget', false);1202 $(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget'); 1206 1203 this.env.last_folder_target = null; 1207 1204 } … … 1214 1211 if (this.check_droptarget(k) && ((mouse.x >= pos.x1) && (mouse.x < pos.x2) 1215 1212 && (mouse.y >= pos.y1) && (mouse.y < pos.y2))) { 1216 this.set_classname(this.get_folder_li(k), 'droptarget', true);1213 $(this.get_folder_li(k)).addClass('droptarget'); 1217 1214 this.env.last_folder_target = k; 1218 1215 } 1219 1216 else 1220 this.set_classname(this.get_folder_li(k), 'droptarget', false);1217 $(this.get_folder_li(k)).removeClass('droptarget'); 1221 1218 } 1222 1219 } … … 1227 1224 var div; 1228 1225 if ((li = this.get_folder_li(id)) && 1229 (div = li.getElementsByTagName("div")[0]) && 1230 (div.className.match(/collapsed/) || div.className.match(/expanded/))) 1231 { 1232 var ul = li.getElementsByTagName("ul")[0]; 1233 if (div.className.match(/collapsed/)) 1234 { 1235 ul.style.display = ''; 1236 this.set_classname(div, 'collapsed', false); 1237 this.set_classname(div, 'expanded', true); 1226 (div = $(li.getElementsByTagName("div")[0])) && 1227 (div.hasClass('collapsed') || div.hasClass('expanded'))) 1228 { 1229 var ul = $(li.getElementsByTagName("ul")[0]); 1230 if (div.hasClass('collapsed')) 1231 { 1232 ul.show(); 1233 div.removeClass('collapsed').addClass('expanded'); 1238 1234 var reg = new RegExp('&'+urlencode(id)+'&'); 1239 1235 this.set_env('collapsed_folders', this.env.collapsed_folders.replace(reg, '')); … … 1241 1237 else 1242 1238 { 1243 ul.style.display = 'none'; 1244 this.set_classname(div, 'expanded', false); 1245 this.set_classname(div, 'collapsed', true); 1239 ul.hide(); 1240 div.removeClass('expanded').addClass('collapsed'); 1246 1241 this.set_env('collapsed_folders', this.env.collapsed_folders+'&'+urlencode(id)+'&'); 1247 1242 … … 1273 1268 else if (this.contact_list) 1274 1269 this.contact_list.focus(); 1275 1276 var mbox_li;1277 if (mbox_li = this.get_folder_li())1278 this.set_classname(mbox_li, 'unfocused', true);1279 1270 1280 1271 return rcube_event.get_button(e) == 2 ? true : rcube_event.cancel(e); … … 1641 1632 this.set_message_status(uid, flag, status); 1642 1633 1634 var rowobj = $(rows[uid].obj); 1643 1635 if (rows[uid].unread && rows[uid].classname.indexOf('unread')<0) 1644 1636 { 1645 1637 rows[uid].classname += ' unread'; 1646 this.set_classname(rows[uid].obj, 'unread', true);1638 rowobj.addClass('unread'); 1647 1639 } 1648 1640 else if (!rows[uid].unread && rows[uid].classname.indexOf('unread')>=0) 1649 1641 { 1650 1642 rows[uid].classname = rows[uid].classname.replace(/\s*unread/, ''); 1651 this.set_classname(rows[uid].obj, 'unread', false);1643 rowobj.removeClass('unread'); 1652 1644 } 1653 1645 … … 1655 1647 { 1656 1648 rows[uid].classname += ' deleted'; 1657 this.set_classname(rows[uid].obj, 'deleted', true);1649 rowobj.addClass('deleted'); 1658 1650 } 1659 1651 else if (!rows[uid].deleted && rows[uid].classname.indexOf('deleted')>=0) 1660 1652 { 1661 1653 rows[uid].classname = rows[uid].classname.replace(/\s*deleted/, ''); 1662 this.set_classname(rows[uid].obj, 'deleted', false);1654 rowobj.removeClass('deleted'); 1663 1655 } 1664 1656 … … 1666 1658 { 1667 1659 rows[uid].classname += ' flagged'; 1668 this.set_classname(rows[uid].obj, 'flagged', true);1660 rowobj.addClass('flagged'); 1669 1661 } 1670 1662 else if (!rows[uid].flagged && rows[uid].classname.indexOf('flagged')>=0) 1671 1663 { 1672 1664 rows[uid].classname = rows[uid].classname.replace(/\s*flagged/, ''); 1673 this.set_classname(rows[uid].obj, 'flagged', false);1665 rowobj.removeClass('flagged'); 1674 1666 } 1675 1667 … … 2285 2277 return false; 2286 2278 2287 var li = document.createElement('LI'); 2288 li.id = name; 2289 li.innerHTML = content; 2290 this.gui_objects.attachmentlist.appendChild(li); 2279 $('<li>').attr('id', name).html(content).appendTo(this.gui_objects.attachmentlist); 2291 2280 return true; 2292 2281 }; … … 2424 2413 this.ksearch_select = function(node) 2425 2414 { 2426 var current = document.getElementById('rcmksearchSelected'); 2427 if (current && node) { 2428 current.removeAttribute('id'); 2429 this.set_classname(current, 'selected', false); 2415 var current = $('#rcmksearchSelected'); 2416 if (current[0] && node) { 2417 current.removeAttr('id').removeClass('selected'); 2430 2418 } 2431 2419 2432 2420 if (node) { 2433 node.setAttribute('id', 'rcmksearchSelected'); 2434 this.set_classname(node, 'selected', true); 2421 $(node).attr('id', 'rcmksearchSelected').addClass('selected'); 2435 2422 this.ksearch_selected = node._rcm_id; 2436 2423 } … … 2536 2523 p = find_in_array(this.ksearch_selected, a_result_ids); 2537 2524 if (p >= 0 && ul.childNodes) { 2538 ul.childNodes[p].setAttribute('id', 'rcmksearchSelected'); 2539 this.set_classname(ul.childNodes[p], 'selected', true); 2525 $(ul.childNodes[p]).attr('id', 'rcmksearchSelected').addClass('selected'); 2540 2526 } 2541 2527 else … … 2545 2531 // if no item selected, select the first one 2546 2532 if (this.ksearch_selected === null) { 2547 ul.firstChild.setAttribute('id', 'rcmksearchSelected'); 2548 this.set_classname(ul.firstChild, 'selected', true); 2533 $(ul.firstChild).attr('id', 'rcmksearchSelected').addClass('selected'); 2549 2534 this.ksearch_selected = a_result_ids[0]; 2550 2535 } … … 2756 2741 { 2757 2742 for (var c=0; c<cols_arr.length; c++) 2758 if (row.cells[c]) 2759 row.cells[c].innerHTML = cols_arr[c]; 2743 $(row.cells[c]).html(cols_arr[c]); 2760 2744 2761 2745 return true; … … 2845 2829 { 2846 2830 if (this.check_droptarget(folder) && 2847 !this.env.subscriptionrows[this.get_folder_row_id(this.env.folder)][2] &&2848 (folder != this.env.folder.replace(reg, '')) &&2831 !this.env.subscriptionrows[this.get_folder_row_id(this.env.folder)][2] && 2832 (folder != this.env.folder.replace(reg, '')) && 2849 2833 (!folder.match(new RegExp('^'+RegExp.escape(this.env.folder+this.env.delimiter))))) 2850 2834 { 2851 2835 this.set_env('dstfolder', folder); 2852 this.set_classname(row, 'droptarget', true);2836 $(row).addClass('droptarget'); 2853 2837 } 2854 2838 } … … 2856 2840 { 2857 2841 this.set_env('dstfolder', this.env.delimiter); 2858 this.set_classname(this.subscription_list.frame, 'droptarget', true);2842 $(this.subscription_list.frame).addClass('droptarget'); 2859 2843 } 2860 2844 } … … 2862 2846 this.unfocus_subscription = function(id) 2863 2847 { 2864 var row ;2848 var row = $('#'+id); 2865 2849 this.set_env('dstfolder', null); 2866 if (this.env.subscriptionrows[id] && 2867 (row = document.getElementById(id))) 2868 this.set_classname(row, 'droptarget', false); 2850 if (this.env.subscriptionrows[id] && row[0]) 2851 row.removeClass('droptarget'); 2869 2852 else 2870 this.set_classname(this.subscription_list.frame, 'droptarget', false);2853 $(this.subscription_list.frame).removeClass('droptarget'); 2871 2854 } 2872 2855 … … 2882 2865 2883 2866 if (this.gui_objects.createfolderhint) 2884 this.gui_objects.createfolderhint.innerHTML = this.env.folder ? this.get_label('addsubfolderhint') : '';2867 $(this.gui_objects.createfolderhint).html(this.env.folder ? this.get_label('addsubfolderhint') : ''); 2885 2868 }; 2886 2869 … … 2969 2952 2970 2953 if (cell && this.edit_folder && this.env.subscriptionrows[this.edit_folder]) 2971 cell.innerHTML = this.env.subscriptionrows[this.edit_folder][1];2954 $(cell).html(this.env.subscriptionrows[this.edit_folder][1]); 2972 2955 2973 2956 this.edit_folder = null; … … 3017 3000 this.set_env('folder', null); 3018 3001 3019 if (this.gui_objects.createfolderhint) 3020 this.gui_objects.createfolderhint.innerHTML = ''; 3002 $(this.gui_objects.createfolderhint).html(''); 3021 3003 } 3022 3004 }; … … 3341 3323 }; 3342 3324 3343 // set/unset a specific class name3344 this.set_classname = function(obj, classname, set)3345 {3346 var reg = new RegExp('\s*'+classname, 'i');3347 if (!set && obj.className.match(reg))3348 obj.className = obj.className.replace(reg, '');3349 else if (set && !obj.className.match(reg))3350 obj.className += ' '+classname;3351 };3352 3353 3325 // write to the document/window title 3354 3326 this.set_pagetitle = function(title) … … 3381 3353 cont = '<div class="'+type+'">'+cont+'</div>'; 3382 3354 3383 var _rcube = this; 3384 this.gui_objects.message.innerHTML = cont; 3385 this.gui_objects.message.style.display = 'block'; 3355 var obj = $(this.gui_objects.message).html(cont).show(); 3386 3356 3387 3357 if (type!='loading') 3388 this.gui_objects.message.onmousedown = function(){ _rcube.hide_message(); return true; };3358 obj.bind('mousedown', function(){ ref.hide_message(); return true; }); 3389 3359 3390 3360 if (!hold) 3391 this.message_timer = window.setTimeout(function(){ ref.hide_message( ); }, this.message_time);3361 this.message_timer = window.setTimeout(function(){ ref.hide_message(true); }, this.message_time); 3392 3362 }; 3393 3363 3394 3364 // make a message row disapear 3395 this.hide_message = function( )3365 this.hide_message = function(fade) 3396 3366 { 3397 3367 if (this.gui_objects.message) 3398 { 3399 this.gui_objects.message.style.display = 'none'; 3400 this.gui_objects.message.onmousedown = null; 3401 } 3368 $(this.gui_objects.message).unbind()[(fade?'fadeOut':'hide')](); 3402 3369 }; 3403 3370 … … 3409 3376 var current_li, target_li; 3410 3377 3411 if ((current_li = this.get_folder_li(old))) 3412 { 3413 this.set_classname(current_li, 'selected', false); 3414 this.set_classname(current_li, 'unfocused', false); 3415 } 3416 3417 if ((target_li = this.get_folder_li(name))) 3418 { 3419 this.set_classname(target_li, 'unfocused', false); 3420 this.set_classname(target_li, 'selected', true); 3378 if ((current_li = this.get_folder_li(old))) { 3379 $(current_li).removeClass('selected').removeClass('unfocused'); 3380 } 3381 3382 if ((target_li = this.get_folder_li(name))) { 3383 $(target_li).removeClass('unfocused').addClass('selected'); 3421 3384 } 3422 3385 } … … 3475 3438 var even = rowcount%2; 3476 3439 3477 this.env.messages[uid] = { deleted:flags.deleted?1:0,3478 replied:flags.replied?1:0,3479 unread:flags.unread?1:0,3480 forwarded:flags.forwarded?1:0,3481 flagged:flags.flagged?1:0};3482 3483 var row = document.createElement('TR');3484 row.id = 'rcmrow'+uid; 3485 row.className= 'message'3486 + (even ? ' even' : ' odd')3440 this.env.messages[uid] = { 3441 deleted: flags.deleted?1:0, 3442 replied: flags.replied?1:0, 3443 unread: flags.unread?1:0, 3444 forwarded: flags.forwarded?1:0, 3445 flagged:flags.flagged?1:0 3446 }; 3447 3448 var css_class = 'message' 3449 + (even ? ' even' : ' odd') 3487 3450 + (flags.unread ? ' unread' : '') 3488 + (flags.deleted ? ' deleted' : '') 3489 + (flags.flagged ? ' flagged' : ''); 3451 + (flags.deleted ? ' deleted' : '') 3452 + (flags.flagged ? ' flagged' : ''); 3453 3454 var row = $('<tr>').attr('id', 'rcmrow'+uid).attr('class', css_class); 3490 3455 3491 3456 if (this.message_list.in_selection(uid)) 3492 row. className += ' selected';3457 row.addClass('selected'); 3493 3458 3494 3459 var icon = this.env.messageicon; … … 3507 3472 icon = this.env.unreadicon; 3508 3473 3509 var col = document.createElement('TD'); 3510 col.className = 'icon'; 3511 col.innerHTML = icon ? '<img src="'+icon+'" alt="" />' : ''; 3512 row.appendChild(col); 3474 // add icon col 3475 $('<td>').addClass('icon').html(icon ? '<img src="'+icon+'" alt="" />' : '').appendTo(row); 3513 3476 3514 3477 // add each submitted col 3515 for (var n = 0; n < this.coltypes.length; n++) 3516 { 3478 for (var n = 0; n < this.coltypes.length; n++) { 3517 3479 var c = this.coltypes[n]; 3518 col = document.createElement('TD'); 3519 col.className = String(c).toLowerCase(); 3480 col = $('<td>').addClass(String(c).toLowerCase()); 3520 3481 3521 if (c=='flag') 3522 { 3482 if (c=='flag') { 3523 3483 if (flags.flagged && this.env.flaggedicon) 3524 col. innerHTML = '<img src="'+this.env.flaggedicon+'" alt="" />';3484 col.html('<img src="'+this.env.flaggedicon+'" alt="" />'); 3525 3485 else if(!flags.flagged && this.env.unflaggedicon) 3526 col. innerHTML = '<img src="'+this.env.unflaggedicon+'" alt="" />';3486 col.html('<img src="'+this.env.unflaggedicon+'" alt="" />'); 3527 3487 } 3528 3488 else if (c=='attachment') 3529 col. innerHTML = attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : ' ';3489 col.html(attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : ' '); 3530 3490 else 3531 col. innerHTML = cols[c];3532 3533 row.appendChild(col);3491 col.html(cols[c]); 3492 3493 col.appendTo(row); 3534 3494 } 3535 3495 … … 3537 3497 3538 3498 // remove 'old' row 3539 if (attop && this.env.pagesize && this.message_list.rowcount > this.env.pagesize) 3540 { 3541 var uid = this.message_list.get_last_row(); 3542 this.message_list.remove_row(uid); 3543 this.message_list.clear_selection(uid); 3544 } 3545 }; 3499 if (attop && this.env.pagesize && this.message_list.rowcount > this.env.pagesize) { 3500 var uid = this.message_list.get_last_row(); 3501 this.message_list.remove_row(uid); 3502 this.message_list.clear_selection(uid); 3503 } 3504 }; 3546 3505 3547 3506 // replace content of row count display 3548 3507 this.set_rowcount = function(text) 3549 3508 { 3550 if (this.gui_objects.countdisplay) 3551 this.gui_objects.countdisplay.innerHTML = text; 3509 $(this.gui_objects.countdisplay).html(text); 3552 3510 3553 3511 // update page navigation buttons … … 3565 3523 this.set_quota = function(content) 3566 3524 { 3567 if ( this.gui_objects.quotadisplay &&content)3568 this.gui_objects.quotadisplay.innerHTML = content;3525 if (content) 3526 $(this.gui_objects.quotadisplay).html(content); 3569 3527 }; 3570 3528 … … 3595 3553 // add children's counters 3596 3554 for (var k in this.env.unread_counts) 3597 if (k.indexOf(mbox + this.env.delimiter) == 0) {3555 if (k.indexOf(mbox + this.env.delimiter) == 0) 3598 3556 childcount += this.env.unread_counts[k]; 3599 }3600 3557 } 3601 3558 … … 3613 3570 3614 3571 // set the right classes 3615 this.set_classname(item, 'unread', (mycount+childcount)>0 ? true : false); 3572 if ((mycount+childcount)>0) 3573 $(item).addClass('unread'); 3574 else 3575 $(item).removeClass('unread'); 3616 3576 } 3617 3577 … … 3654 3614 var even = rowcount%2; 3655 3615 3656 var row = document.createElement('TR'); 3657 row.id = 'rcmrow'+cid; 3658 row.className = 'contact '+(even ? 'even' : 'odd'); 3616 var row = $('<tr>').attr('id', 'rcmrow'+cid).addClass('class').addClass(even ? 'even' : 'odd'); 3659 3617 3660 3618 if (this.contact_list.in_selection(cid)) 3661 row. className += ' selected';3619 row.addClass('selected'); 3662 3620 3663 3621 // add each submitted col 3664 for (var c in cols) 3665 { 3666 col = document.createElement('TD'); 3667 col.className = String(c).toLowerCase(); 3668 col.innerHTML = cols[c]; 3669 row.appendChild(col); 3670 } 3622 for (var c in cols) { 3623 col = $('<td>').addClass(String(c).toLowerCase()).html(cols[c]).appendTo(row); 3624 } 3671 3625 3672 3626 this.contact_list.insert_row(row); … … 3683 3637 // display fetched raw headers 3684 3638 this.set_headers = function(content) 3685 { 3686 if (this.gui_objects.all_headers_row && this.gui_objects.all_headers_box && content) 3687 { 3688 var box = this.gui_objects.all_headers_box; 3689 box.innerHTML = content; 3690 box.style.display = 'block'; 3639 { 3640 if (this.gui_objects.all_headers_row && this.gui_objects.all_headers_box && content) { 3641 $(this.gui_objects.all_headers_box).html(content).show(); 3691 3642 3692 3643 if (this.env.framed && parent.rcmail) 3693 parent.rcmail.set_busy(false);3644 parent.rcmail.set_busy(false); 3694 3645 else 3695 3646 this.set_busy(false); 3696 }3697 };3647 } 3648 }; 3698 3649 3699 3650 // display all-headers row and fetch raw message headers … … 3703 3654 return; 3704 3655 3705 this.set_classname(elem, 'show-headers', false); 3706 this.set_classname(elem, 'hide-headers', true); 3707 this.gui_objects.all_headers_row.style.display = bw.ie ? 'block' : 'table-row'; 3656 $(elem).removeClass('show-headers').addClass('hide-headers'); 3657 $(this.gui_objects.all_headers_row).show(); 3708 3658 elem.onclick = function() { rcmail.hide_headers(elem); } 3709 3659 … … 3711 3661 if (!this.gui_objects.all_headers_box.innerHTML) 3712 3662 { 3713 this.display_message(this.get_label('loading'), 'loading', true); 3663 this.display_message(this.get_label('loading'), 'loading', true); 3714 3664 this.http_post('headers', '_uid='+this.env.uid); 3715 3665 } … … 3722 3672 return; 3723 3673 3724 this.set_classname(elem, 'hide-headers', false); 3725 this.set_classname(elem, 'show-headers', true); 3726 this.gui_objects.all_headers_row.style.display = 'none'; 3674 $(elem).removeClass('hide-headers').addClass('show-headers'); 3675 $(this.gui_objects.all_headers_row).hide(); 3727 3676 elem.onclick = function() { rcmail.load_headers(elem); } 3728 3677 } … … 3793 3742 } 3794 3743 else 3795 postdata += (postdata ? '&' : '') + '_remote=1' ;3744 postdata += (postdata ? '&' : '') + '_remote=1' + (lock ? '&_unlock=1' : ''); 3796 3745 3797 3746 // send request … … 3977 3926 } // end object rcube_webmail 3978 3927 3979 3980 // helper function to call the init method with a delay3981 function call_init(o)3982 {3983 window.setTimeout('if (window[\''+o+'\'] && window[\''+o+'\'].init) { '+o+'.init(); }',3984 bw.win ? 500 : 200);3985 }3986 -
branches/devel-api/program/js/editor.js
r2040 r2260 50 50 spellchecker_languages : (rcmail.env.spellcheck_langs ? rcmail.env.spellcheck_langs : 'Dansk=da,Deutsch=de,+English=en,Espanol=es,Francais=fr,Italiano=it,Nederlands=nl,Polski=pl,Portugues=pt,Suomi=fi,Svenska=sv'), 51 51 gecko_spellcheck : true, 52 rc_client: rc ube_webmail_client,52 rc_client: rcmail, 53 53 oninit : 'rcmail_editor_callback' 54 54 }); -
branches/devel-api/program/js/list.js
r2150 r2260 161 161 { 162 162 var tbody = this.list.tBodies[0]; 163 if (!row.jquery) 164 row = $(row); 163 165 164 166 if (attop && tbody.rows.length) 165 tbody.insertBefore(row, tbody.firstChild);167 row.prependTo(tbody) 166 168 else 167 tbody.appendChild(row);168 169 this.init_row(row );169 row.appendTo(tbody); 170 171 this.init_row(row[0]); 170 172 this.rowcount++; 171 173 }, … … 182 184 { 183 185 id = this.selection[n]; 184 if (this.rows[id] && this.rows[id].obj) 185 { 186 this.set_classname(this.rows[id].obj, 'selected', true); 187 this.set_classname(this.rows[id].obj, 'unfocused', false); 186 if (this.rows[id] && this.rows[id].obj) { 187 $(this.rows[id].obj).addClass('selected').removeClass('unfocused'); 188 188 } 189 189 } … … 204 204 { 205 205 id = this.selection[n]; 206 if (this.rows[id] && this.rows[id].obj) 207 { 208 this.set_classname(this.rows[id].obj, 'selected', false); 209 this.set_classname(this.rows[id].obj, 'unfocused', true); 206 if (this.rows[id] && this.rows[id].obj) { 207 $(this.rows[id].obj).removeClass('selected').addClass('unfocused'); 210 208 } 211 209 } … … 252 250 iframedoc = iframes[n].contentDocument; 253 251 else if (iframes[n].contentWindow) 254 iframedoc = iframes[n].contentWindow.document;252 iframedoc = iframes[n].contentWindow.document; 255 253 else if (iframes[n].document) 256 254 iframedoc = iframes[n].document; … … 258 256 if (iframedoc) 259 257 { 260 var list = this;261 var pos = rcube_get_object_pos(document.getElementById(iframes[n].id));262 this.iframe_events[n] = function(e) { e._offset = pos; return list.drag_mouse_move(e); }263 264 if (iframedoc.addEventListener)265 iframedoc.addEventListener('mousemove', this.iframe_events[n], false);266 else if (iframes[n].attachEvent)267 iframedoc.attachEvent('onmousemove', this.iframe_events[n]);268 else269 iframedoc['onmousemove'] = this.iframe_events[n];258 var list = this; 259 var pos = $('#'+iframes[n].id).offset(); 260 this.iframe_events[n] = function(e) { e._offset = pos; return list.drag_mouse_move(e); } 261 262 if (iframedoc.addEventListener) 263 iframedoc.addEventListener('mousemove', this.iframe_events[n], false); 264 else if (iframes[n].attachEvent) 265 iframedoc.attachEvent('onmousemove', this.iframe_events[n]); 266 else 267 iframedoc['onmousemove'] = this.iframe_events[n]; 270 268 271 269 rcube_event.add_listener({element:iframedoc, event:'mouseup', object:this, method:'drag_mouse_up'}); 272 270 } 273 } 271 } 274 272 } 275 273 … … 411 409 412 410 if (this.last_selected != 0 && this.rows[this.last_selected]) 413 this.set_classname(this.rows[this.last_selected].obj, 'focused', false);411 $(this.rows[this.last_selected].obj).removeClass('focused'); 414 412 415 413 // unselect if toggleselect is active and the same row was clicked again … … 420 418 } 421 419 else 422 this.set_classname(this.rows[id].obj, 'focused', true);420 $(this.rows[id].obj).addClass('focused'); 423 421 424 422 if (!this.selection.length) … … 539 537 { 540 538 for (var n=0; n<this.selection.length; n++) 541 if (this.selection[n] == id) 542 { 543 this.selection.splice(n,1); 544 break; 545 } 539 if (this.selection[n] == id) { 540 this.selection.splice(n,1); 541 break; 542 } 546 543 } 547 544 // all rows … … 549 546 { 550 547 for (var n=0; n<this.selection.length; n++) 551 if (this.rows[this.selection[n]]) 552 { 553 this.set_classname(this.rows[this.selection[n]].obj, 'selected', false); 554 this.set_classname(this.rows[this.selection[n]].obj, 'unfocused', false); 548 if (this.rows[this.selection[n]]) { 549 $(this.rows[this.selection[n]].obj).removeClass('selected').removeClass('unfocused'); 555 550 } 556 551 … … 595 590 this.clear_selection(); 596 591 this.selection[0] = id; 597 this.set_classname(this.rows[id].obj, 'selected', true);592 $(this.rows[id].obj).addClass('selected'); 598 593 } 599 594 } … … 603 598 { 604 599 this.selection[this.selection.length] = id; 605 this.set_classname(this.rows[id].obj, 'selected', true);600 $(this.rows[id].obj).addClass('selected'); 606 601 } 607 602 else // unselect row … … 611 606 var a_post = this.selection.slice(p+1, this.selection.length); 612 607 this.selection = a_pre.concat(a_post); 613 this.set_classname(this.rows[id].obj, 'selected', false); 614 this.set_classname(this.rows[id].obj, 'unfocused', false); 608 $(this.rows[id].obj).removeClass('selected').removeClass('unfocused'); 615 609 } 616 610 } … … 828 822 829 823 /** 830 * set/unset a specific class name831 */832 set_classname: function(obj, classname, set)833 {834 var reg = new RegExp('\s*'+classname, 'i');835 if (!set && obj.className.match(reg))836 obj.className = obj.className.replace(reg, '');837 else if (set && !obj.className.match(reg))838 obj.className += ' '+classname;839 },840 841 842 /**843 824 * Setter for object event handlers 844 825 *
Note: See TracChangeset
for help on using the changeset viewer.
