[0] | 1 | $(function() { |
---|
[2287] | 2 | // expand a module line |
---|
[2354] | 3 | $('table.modules.expandable tr.line').each(function(){ |
---|
| 4 | $('td.module-name',this).toggleWithLegend($(this).next('.module-more'),{ |
---|
| 5 | img_on_src: dotclear.img_plus_src, |
---|
| 6 | img_on_alt: dotclear.img_plus_alt, |
---|
| 7 | img_off_src: dotclear.img_minus_src, |
---|
| 8 | img_off_alt: dotclear.img_minus_alt, |
---|
| 9 | legend_click: true |
---|
| 10 | }); |
---|
[2287] | 11 | }); |
---|
| 12 | |
---|
[2487] | 13 | // checkboxes selection |
---|
| 14 | $('.checkboxes-helpers').each(function() { |
---|
| 15 | dotclear.checkboxesHelpers(this); |
---|
| 16 | }); |
---|
| 17 | |
---|
| 18 | // actions tests |
---|
| 19 | $('.modules-form-actions').each(function(){ |
---|
| 20 | var rxActionType = /^[^\[]+/; |
---|
| 21 | var rxActionValue = /([^\[]+)\]$/; |
---|
| 22 | var checkboxes = $(this).find('input[type=checkbox]'); |
---|
| 23 | |
---|
| 24 | // check if submit is a global action or one line action |
---|
| 25 | $("input[type=submit]",this).click(function() { |
---|
| 26 | var keyword = $(this).attr('name'); |
---|
| 27 | var maction = keyword.match(rxActionType); |
---|
| 28 | var action = maction[0]; |
---|
| 29 | var mvalues = keyword.match(rxActionValue); |
---|
| 30 | |
---|
| 31 | // action on multiple modules |
---|
| 32 | if (!mvalues) { |
---|
| 33 | var checked = false; |
---|
| 34 | |
---|
| 35 | // check if there is checkboxes in form |
---|
| 36 | if(checkboxes.length > 0) { |
---|
| 37 | // check if there is at least one checkbox checked |
---|
| 38 | $(checkboxes).each(function() { |
---|
| 39 | if (this.checked) { |
---|
| 40 | checked = true; |
---|
| 41 | } |
---|
| 42 | }); |
---|
| 43 | if (!checked) { |
---|
| 44 | //alert(dotclear.msg.no_selection); |
---|
| 45 | return false; |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | // confirm delete |
---|
| 50 | if (action == 'delete') { |
---|
| 51 | return window.confirm(dotclear.msg.confirm_delete_plugins); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | // action on one module |
---|
| 55 | }else { |
---|
| 56 | var module = mvalues[1]; |
---|
| 57 | |
---|
| 58 | // confirm delete |
---|
| 59 | if (action == 'delete') { |
---|
| 60 | return window.confirm(dotclear.msg.confirm_delete_plugin.replace('%s',module)); |
---|
| 61 | } |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | return true; |
---|
| 65 | }); |
---|
[2287] | 66 | }); |
---|
[2566] | 67 | }); |
---|