Changeset 68b6a9e in github
- Timestamp:
- Oct 19, 2007 8:24:04 AM (6 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 3e71ab7
- Parents:
- dcf134c
- Location:
- program
- Files:
-
- 3 edited
-
js/app.js (modified) (14 diffs)
-
js/list.js (modified) (2 diffs)
-
steps/settings/manage_folders.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/js/app.js
rb119e24 r68b6a9e 942 942 943 943 case 'delete-folder': 944 if (confirm(this.get_label('deletefolderconfirm'))) 945 this.delete_folder(props); 944 this.delete_folder(props); 946 945 break; 947 946 … … 2410 2409 { 2411 2410 var p = this; 2412 this.subscription_list = new rcube_list_widget(this.gui_objects.subscriptionlist, {multiselect:false, draggable:true, keyboard:false });2411 this.subscription_list = new rcube_list_widget(this.gui_objects.subscriptionlist, {multiselect:false, draggable:true, keyboard:false, toggleselect:true}); 2413 2412 this.subscription_list.addEventListener('select', function(o){ p.subscription_select(o); }); 2414 2413 this.subscription_list.addEventListener('dragstart', function(o){ p.drag_active = true; }); 2415 2414 this.subscription_list.addEventListener('dragend', function(o){ p.subscription_move_folder(o); }); 2415 this.subscription_list.row_init = function (row) 2416 { 2417 var anchors = row.obj.getElementsByTagName('A'); 2418 if (anchors[0]) 2419 anchors[0].onclick = function() { p.rename_folder(row.id); }; 2420 if (anchors[1]) 2421 anchors[1].onclick = function() { p.delete_folder(row.id); }; 2422 row.obj.onmouseover = function() { p.focus_subscription(row.id); }; 2423 row.obj.onmouseout = function() { p.unfocus_subscription(row.id); }; 2424 } 2416 2425 this.subscription_list.init(); 2417 2426 } … … 2466 2475 this.focus_subscription = function(id) 2467 2476 { 2468 var row ;2477 var row, folder; 2469 2478 var reg = RegExp('['+RegExp.escape(this.env.delimiter)+']?[^'+RegExp.escape(this.env.delimiter)+']+$'); 2470 if (this.drag_active && this.check_droptarget(id) && 2471 (id != this.env.folder.replace(reg, '')) && 2472 (!id.match(new RegExp('^'+RegExp.escape(this.env.folder+this.env.delimiter)))) && 2473 (row = document.getElementById(this.get_folder_row_id(id)))) 2474 if (find_in_array(this.env.defaultfolders, id)>=0) 2479 if (this.env.subscriptionrows[id] && 2480 (folder = this.env.subscriptionrows[id][0]) && 2481 this.drag_active && this.check_droptarget(folder) && 2482 (folder != this.env.folder.replace(reg, '')) && 2483 (!folder.match(new RegExp('^'+RegExp.escape(this.env.folder+this.env.delimiter)))) && 2484 (row = document.getElementById(id))) 2485 if (find_in_array(this.env.defaultfolders, folder)>=0) 2475 2486 { 2476 2487 if (this.env.folder.replace(reg, '')!='') … … 2482 2493 else 2483 2494 { 2484 this.set_env('dstfolder', id);2495 this.set_env('dstfolder', folder); 2485 2496 this.set_classname(row, 'droptarget', true); 2486 2497 } … … 2490 2501 this.unfocus_subscription = function(id) 2491 2502 { 2492 var row; 2493 if (row = document.getElementById(this.get_folder_row_id(id))) 2503 var row, folder; 2504 if (this.env.subscriptionrows[id] && 2505 (folder = this.env.subscriptionrows[id][0]) && 2506 (row = document.getElementById(id))) 2494 2507 { 2495 2508 this.set_env('dstfolder', null); 2496 if (find_in_array(this.env.defaultfolders, id)>=0)2509 if (find_in_array(this.env.defaultfolders, folder)>=0) 2497 2510 this.set_classname(this.subscription_list.frame, 'droptarget', false); 2498 2511 else … … 2504 2517 this.subscription_select = function(list) 2505 2518 { 2506 var id; 2507 if (id = list.get_single_selection()) 2508 { 2509 if (this.env.subscriptionrows['rcmrow'+id]) 2510 { 2511 var folder = this.env.subscriptionrows['rcmrow'+id][0]; 2512 if (find_in_array(this.env.defaultfolders, folder)!=0) 2513 this.set_env('folder', folder); 2514 } 2515 else 2516 { 2517 list.clear_selection(); 2518 this.set_env('folder', null); 2519 } 2520 } 2519 var id, folder; 2520 if ((id = list.get_single_selection()) && 2521 this.env.subscriptionrows['rcmrow'+id] && 2522 (folder = this.env.subscriptionrows['rcmrow'+id][0]) && 2523 (find_in_array(this.env.defaultfolders, folder)!=0)) 2524 this.set_env('folder', folder); 2525 else 2526 this.set_env('folder', null); 2521 2527 }; 2522 2528 … … 2534 2540 } 2535 2541 this.drag_active = false; 2536 this.unfocus_subscription(this. env.dstfolder);2542 this.unfocus_subscription(this.get_folder_row_id(this.env.dstfolder)); 2537 2543 }; 2538 2544 … … 2559 2565 // start renaming the mailbox name. 2560 2566 // this will replace the name string with an input field 2561 this.rename_folder = function( folder)2567 this.rename_folder = function(id) 2562 2568 { 2563 2569 var temp, row, form; 2564 var id = this.get_folder_row_id(folder);2570 var folder = this.env.subscriptionrows[id][0]; 2565 2571 2566 2572 // reset current renaming … … 2629 2635 2630 2636 // delete a specific mailbox with all its messages 2631 this.delete_folder = function(folder) 2632 { 2637 this.delete_folder = function(id) 2638 { 2639 var folder = this.env.subscriptionrows[id][0]; 2640 2633 2641 if (this.edit_folder) 2634 2642 this.reset_folder_rename(); 2635 2636 if (folder) 2643 2644 if (folder && confirm(this.get_label('deletefolderconfirm'))) 2645 { 2637 2646 this.http_post('delete-folder', '_mboxes='+urlencode(folder)); 2638 2639 this.set_env('folder', null);2647 this.set_env('folder', null); 2648 } 2640 2649 }; 2641 2650 … … 2654 2663 var refrow, form; 2655 2664 var tbody = this.gui_objects.subscriptionlist.tBodies[0]; 2656 var id = replace && replace.id ? replace.id : tbody.childNodes.length+1;2665 var id = replace && replace.id ? replace.id : 'rcmrow'+(tbody.childNodes.length+1); 2657 2666 var selection = this.subscription_list.get_single_selection(); 2658 2667 … … 2666 2675 // clone a table row if there are existing rows 2667 2676 var row = this.clone_table_row(refrow); 2668 row.id = 'rcmrow'+id;2677 row.id = id; 2669 2678 if (replace) 2670 2679 tbody.replaceChild(row, replace); … … 2684 2693 } 2685 2694 2686 if (row.cells[2] && row.cells[2].firstChild.tagName=='A')2687 row.cells[2].firstChild.onclick = new Function(this.ref+".command('rename-folder','"+name.replace('\'','\\\'')+"')");2688 if (row.cells[3] && row.cells[3].firstChild.tagName=='A')2689 row.cells[3].firstChild.onclick = new Function(this.ref+".command('delete-folder','"+name.replace('\'','\\\'')+"')");2690 2691 2695 // add new folder to rename-folder list and clear input field 2692 2696 if (!replace && (form = this.gui_objects.editform)) … … 2703 2707 this.subscription_list.select_row(selection); 2704 2708 2705 if (document.getElementById( 'rcmrow'+id).scrollIntoView)2706 document.getElementById( 'rcmrow'+id).scrollIntoView();2709 if (document.getElementById(id).scrollIntoView) 2710 document.getElementById(id).scrollIntoView(); 2707 2711 }; 2708 2712 … … 2716 2720 // replace an existing table row (if found) 2717 2721 this.add_folder_row(newfolder, display_name, row); 2718 this.env.subscriptionrows[id] = null;2719 2722 2720 2723 // rename folder in rename-folder dropdown -
program/js/list.js
rb6265631 r68b6a9e 38 38 this.draggable = false; 39 39 this.keyboard = false; 40 this.toggleselect = false; 40 41 41 42 this.dont_select = false; … … 348 349 this.shift_start = null; 349 350 351 if (this.toggleselect && this.last_selected==id) 352 this.highlight_row(id, true); 353 350 354 this.last_selected = id; 351 this.set_classname(this.rows[id].obj, 'focused', true); 355 this.set_classname(this.rows[id].obj, 'focused', true); 352 356 }, 353 357 -
program/steps/settings/manage_folders.inc
rc685105 r68b6a9e 72 72 else if ($_action=='rename-folder') 73 73 { 74 $a_mboxes = array_ merge($IMAP->list_mailboxes(), $IMAP->list_unsubscribed());74 $a_mboxes = array_unique(array_merge($IMAP->list_mailboxes(), $IMAP->list_unsubscribed())); 75 75 $delimiter = $IMAP->get_hierarchy_delimiter(); 76 76 … … 196 196 $a_js_folders['rcmrow'.($i+1)] = array($folder, rcube_charset_convert($folder, 'UTF-7')); 197 197 198 $out .= sprintf('<tr id="rcmrow%d" class="%s"' . 199 ' onmouseover="return %s.focus_subscription(\'%s\')"' . 200 ' onmouseout="return %s.unfocus_subscription(\'%s\')"><td>%s</td>', 198 $out .= sprintf('<tr id="rcmrow%d" class="%s"><td>%s</td>', 201 199 $i+1, 202 200 $zebra_class, 203 JS_OBJECT_NAME,204 $folder_js,205 JS_OBJECT_NAME,206 $folder_js,207 201 Q($folder_html)); 208 202 … … 214 208 // add rename and delete buttons 215 209 if (!$protected) 216 $out .= sprintf('<td><a href="#rename" onclick="%s.command(\'rename-folder\',\'%s\')" title="%s">%s</a>'. 217 '<td><a href="#delete" onclick="%s.command(\'delete-folder\',\'%s\')" title="%s">%s</a></td>', 218 JS_OBJECT_NAME, 219 $folder_js, 210 $out .= sprintf('<td><a href="#rename" title="%s">%s</a>'. 211 '<td><a href="#delete" title="%s">%s</a></td>', 220 212 rcube_label('renamefolder'), 221 213 $edit_button, 222 JS_OBJECT_NAME,223 $folder_js,224 214 rcube_label('deletefolder'), 225 215 $del_button);
Note: See TracChangeset
for help on using the changeset viewer.
