3 // clicking on book checks chunks, too
4 $("input[name=select_book]").change(function(ev) {
6 $book.closest("table").find("input[name=select_chunk][data-book-id=" + $book.val() + "]").attr("checked", $book.is(':checked'));
9 // initialize context menu
11 var get_ids = function() {
12 return $.map($("input[name=select_chunk]:checked"), function(ele, idx) {
15 $.map($("input[name=select_book][data-chunk-id!=]:checked"), function(ele, idx) {
16 return $(ele).attr("data-chunk-id");
21 var set_field = function(key, ops) {
27 if (key == "publish" || key == "unpublish") {
30 var kp = key.split('_');
32 var idx = parseInt(kp[1]);
34 fds[field] = $("select[name="+field+"] option[value!=]").eq(idx).val();
36 /* fill in the form */
37 $("#chunk_mass_edit [name=ids]").val(get_ids());
39 $("#chunk_mass_edit [name="+fn+"]").val(fds[fn]);
42 $.post($("#chunk_mass_edit").attr("action"),
43 $("#chunk_mass_edit").serialize(),
44 function(data, status) {
45 location.reload(true);
53 var get_items = function(field) {
55 $.each($("select[name="+field+"] option[value!=]"),
57 d[field+"_"+idx] = { name: $(ele).text() };
64 selector: '#file-list',
68 items: get_items("stage"),
73 items: get_items("user"),
77 name: "Mark publishable",
81 name: "Mark not publishable",