2 var editing_order = false;
5 function order_button_click(node)
9 form = $("#reorderform");
10 rows = $("#patchlist").get(0).tBodies[0].rows;
17 /* disable the save button */
20 /* add input elements as the sequence of patches */
21 for (var i = 0; i < rows.length; i++) {
22 form.append('<input type="hidden" name="neworder" value="' +
23 row_to_patch_id(rows[i]) + '"/>');
29 /* store the first order value */
30 start_order = row_to_patch_id(rows[0]);
31 $("input[name='order_start']").attr("value", start_order);
34 node.setAttribute("value", "Save order");
35 $("#reorder\\-cancel").css("display", "inline");
38 $("#reorderhelp").text('Drag & drop rows to reorder');
40 /* enable drag & drop on the patches list */
41 $("#patchlist").tableDnD({
42 onDragClass: 'dragging',
43 onDragStart: function() { dragging = true; },
44 onDrop: function() { dragging = false; }
47 /* replace zebra striping with hover */
48 $("#patchlist tbody tr").css("background", "inherit");
49 $("#patchlist tbody tr").hover(drag_hover_in, drag_hover_out);
52 editing_order = !editing_order;
55 function order_cancel_click(node)
60 /* dragging helper functions */
61 function drag_hover_in()
64 $(this).addClass("draghover");
66 function drag_hover_out()
68 $(this).removeClass("draghover");
71 function row_to_patch_id(node)
75 id_str = node.getAttribute("id");
77 i = id_str.indexOf(':');
81 return id_str.substring(i + 1);